summaryrefslogtreecommitdiff
path: root/lib/sqfs/data_writer.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-16 19:29:27 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-16 22:47:59 +0200
commitbfd876dbf151df164b4d87de20aec39b24f205f9 (patch)
tree53ac348da6c430b1ecf5f546ee4758ac73cb16e0 /lib/sqfs/data_writer.c
parent74a064d9f15fa2d534e8b2d1ade68d10d5b65dfd (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_writer.c')
-rw-r--r--lib/sqfs/data_writer.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/sqfs/data_writer.c b/lib/sqfs/data_writer.c
index cbe2351..eebd2a4 100644
--- a/lib/sqfs/data_writer.c
+++ b/lib/sqfs/data_writer.c
@@ -41,24 +41,16 @@ static int write_compressed(data_writer_t *data, const void *in, size_t size,
if (ret > 0 && (size_t)ret < size) {
size = ret;
- ret = write_retry(data->outfd, data->scratch, size);
+ in = data->scratch;
*outsize = size;
} else {
- ret = write_retry(data->outfd, in, size);
*outsize = size | (1 << 24);
}
- if (ret < 0) {
- perror("writing to output file");
+ if (write_data("writing data block", data->outfd, in, size))
return -1;
- }
-
- if ((size_t)ret < size) {
- fputs("write to output file truncated\n", stderr);
- return -1;
- }
- data->super->bytes_used += ret;
+ data->super->bytes_used += size;
return 0;
}