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 --- bin/tar2sqfs/src/tar2sqfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/tar2sqfs') diff --git a/bin/tar2sqfs/src/tar2sqfs.c b/bin/tar2sqfs/src/tar2sqfs.c index f7ed060..ed671f5 100644 --- a/bin/tar2sqfs/src/tar2sqfs.c +++ b/bin/tar2sqfs/src/tar2sqfs.c @@ -12,12 +12,15 @@ int main(int argc, char **argv) sqfs_istream_t *input_file = NULL; dir_iterator_t *tar = NULL; sqfs_writer_t sqfs; + int ret; process_args(argc, argv); - input_file = istream_open_stdin(); - if (input_file == NULL) + ret = istream_open_stdin(&input_file); + if (ret) { + sqfs_perror("stdint", "creating stream wrapper", ret); return EXIT_FAILURE; + } tar = tar_open_stream(input_file); sqfs_drop(input_file); -- cgit v1.2.3