From fd5c9f1259d0191af57b20f06dda35e62acb6275 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 13 Jun 2023 23:44:19 +0200 Subject: Overhaul sqfs_istream_t/sqfs_ostream_t error handling Report an error number from the implementations, change the users to forward that error number (which also means libtar write header/link now returns an error code) and all subsequent binaries to use sqfs_perror() instead of relying on the function to print an error internally. Also, make sure to preserve errno/GetLastError() in the implementations and print out a stringified error in sqfs_perror() if the error code indicates an I/O error. Signed-off-by: David Oberhollenzer --- lib/tar/test/tar_xattr_bin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/tar/test/tar_xattr_bin.c') diff --git a/lib/tar/test/tar_xattr_bin.c b/lib/tar/test/tar_xattr_bin.c index 94c8d76..617c356 100644 --- a/lib/tar/test/tar_xattr_bin.c +++ b/lib/tar/test/tar_xattr_bin.c @@ -23,9 +23,11 @@ int main(int argc, char **argv) tar_header_decoded_t hdr; sqfs_istream_t *fp; char buffer[6]; + int ret; (void)argc; (void)argv; - fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); + ret = istream_open_file(&fp, STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); + TEST_EQUAL_I(ret, 0); TEST_NOT_NULL(fp); TEST_ASSERT(read_header(fp, &hdr) == 0); TEST_EQUAL_UI(hdr.mode, S_IFREG | 0644); -- cgit v1.2.3