summaryrefslogtreecommitdiff
path: root/lib/sqfs/data_reader.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-16 21:02:58 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-16 22:48:00 +0200
commite3ef871d6a80d72db02c9ab1ef492e8f58c2ddeb (patch)
treeec28b205b651e83c795e1e264aacfe5bcb307bc4 /lib/sqfs/data_reader.c
parentbfd876dbf151df164b4d87de20aec39b24f205f9 (diff)
cleanup: move error handling into read_retry
If read_retry fails to read the expected amount of data (EOF or otherwise), it is almost always an error. This commit renames read_retry to read_data and moves error handling into the function, making a lot of error handling code redundant. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/data_reader.c')
-rw-r--r--lib/sqfs/data_reader.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c
index 7f857b2..96ccb39 100644
--- a/lib/sqfs/data_reader.c
+++ b/lib/sqfs/data_reader.c
@@ -110,13 +110,9 @@ int data_reader_dump_file(data_reader_t *data, file_info_t *fi, int outfd,
if (bs == 0) {
memset(data->buffer, 0, unpackedsz);
compressed = false;
- } else {
- ret = read_retry(data->sqfsfd, data->buffer, bs);
- if (ret < 0)
- goto fail_rd;
-
- if ((size_t)ret < bs)
- goto fail_trunc;
+ } else if (read_data("reading data block",
+ data->sqfsfd, data->buffer, bs)) {
+ return -1;
}
if (compressed) {
@@ -163,12 +159,6 @@ fail_sparse:
fail_seek:
perror("seek on squashfs");
return -1;
-fail_rd:
- perror("reading from squashfs");
- return -1;
-fail_trunc:
- fputs("reading from squashfs: unexpected end of file\n", stderr);
- return -1;
fail_bs:
fputs("found compressed block larger than block size\n", stderr);
return -1;