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/src/read_sparse_map_old.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/tar/src/read_sparse_map_old.c') diff --git a/lib/tar/src/read_sparse_map_old.c b/lib/tar/src/read_sparse_map_old.c index 1794073..0915214 100644 --- a/lib/tar/src/read_sparse_map_old.c +++ b/lib/tar/src/read_sparse_map_old.c @@ -60,8 +60,11 @@ sparse_map_t *read_gnu_old_sparse(sqfs_istream_t *fp, tar_header_t *hdr) do { ret = sqfs_istream_read(fp, &sph, sizeof(sph)); - if (ret < 0) + if (ret < 0) { + sqfs_perror(fp->get_filename(fp), + "reading old GNU sparse list", ret); goto fail; + } if ((size_t)ret < sizeof(sph)) goto fail_eof; -- cgit v1.2.3