aboutsummaryrefslogtreecommitdiff
path: root/lib/tar/test/tar_iterator.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-13 23:44:19 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 14:09:56 +0200
commitfd5c9f1259d0191af57b20f06dda35e62acb6275 (patch)
treee45b73872c40531c5c2fa9c3b07096e5827ac6ea /lib/tar/test/tar_iterator.c
parent89cdef0859259fdea0165b0d3918777d1ed42955 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar/test/tar_iterator.c')
-rw-r--r--lib/tar/test/tar_iterator.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c
index f51ecd6..8de50ed 100644
--- a/lib/tar/test/tar_iterator.c
+++ b/lib/tar/test/tar_iterator.c
@@ -36,10 +36,13 @@ int main(int argc, char **argv)
char buffer[100];
sqfs_s32 ret;
sqfs_s64 ts;
+ int iret;
(void)argc; (void)argv;
/* Open the file, create an iterator */
- fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ iret = istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ TEST_EQUAL_I(iret, 0);
TEST_NOT_NULL(fp);
TEST_EQUAL_UI(((sqfs_object_t *)fp)->refcount, 1);
it = tar_open_stream(fp);
@@ -106,7 +109,9 @@ int main(int argc, char **argv)
sqfs_drop(fp);
/* re-open the tar iterator */
- fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ iret = istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ TEST_EQUAL_I(iret, 0);
TEST_NOT_NULL(fp);
it = tar_open_stream(fp);
TEST_NOT_NULL(it);