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_fuzz.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/tar/test/tar_fuzz.c') diff --git a/lib/tar/test/tar_fuzz.c b/lib/tar/test/tar_fuzz.c index 92c0952..42fe73d 100644 --- a/lib/tar/test/tar_fuzz.c +++ b/lib/tar/test/tar_fuzz.c @@ -8,6 +8,7 @@ #include "io/file.h" #include "tar/tar.h" +#include "common.h" #include #include @@ -23,9 +24,11 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - fp = istream_open_file(argv[1]); - if (fp == NULL) + ret = istream_open_file(&fp, argv[1]); + if (ret) { + sqfs_perror("stdint", NULL, ret); return EXIT_FAILURE; + } for (;;) { ret = read_header(fp, &hdr); -- cgit v1.2.3