diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-16 19:29:27 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-16 22:47:59 +0200 |
commit | bfd876dbf151df164b4d87de20aec39b24f205f9 (patch) | |
tree | 53ac348da6c430b1ecf5f546ee4758ac73cb16e0 /lib/sqfs/data_reader.c | |
parent | 74a064d9f15fa2d534e8b2d1ade68d10d5b65dfd (diff) |
cleanup: move error handling into write_retry
If write_retry fails to write everything, it is *always* an error.
This commit renames write_retry to write_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.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c index ec85412..7f857b2 100644 --- a/lib/sqfs/data_reader.c +++ b/lib/sqfs/data_reader.c @@ -133,12 +133,10 @@ int data_reader_dump_file(data_reader_t *data, file_info_t *fi, int outfd, ptr = data->buffer; } - ret = write_retry(outfd, ptr, unpackedsz); - if (ret < 0) - goto fail_wr; - - if ((size_t)ret < bs) - goto fail_wr_trunc; + if (write_data("writing uncompressed block", + outfd, ptr, unpackedsz)) { + return -1; + } } } @@ -152,12 +150,10 @@ int data_reader_dump_file(data_reader_t *data, file_info_t *fi, int outfd, return -1; } - ret = write_retry(outfd, data->buffer, fragsz); - if (ret < 0) - goto fail_wr; - - if ((size_t)ret < fragsz) - goto fail_wr_trunc; + if (write_data("writing uncompressed fragment", + outfd, data->buffer, fragsz)) { + return -1; + } } return 0; @@ -167,12 +163,6 @@ fail_sparse: fail_seek: perror("seek on squashfs"); return -1; -fail_wr: - perror("writing uncompressed block"); - return -1; -fail_wr_trunc: - fputs("writing uncompressed block: truncated write\n", stderr); - return -1; fail_rd: perror("reading from squashfs"); return -1; |