summaryrefslogtreecommitdiff
path: root/lib/sqfs/meta_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/meta_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/meta_writer.c')
-rw-r--r--lib/sqfs/meta_writer.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/sqfs/meta_writer.c b/lib/sqfs/meta_writer.c
index ef869e7..d55af3d 100644
--- a/lib/sqfs/meta_writer.c
+++ b/lib/sqfs/meta_writer.c
@@ -38,24 +38,10 @@ struct meta_writer_t {
static int write_block(int fd, meta_block_t *outblk)
{
- size_t count;
- ssize_t ret;
-
- count = le16toh(((uint16_t *)outblk->data)[0]) & 0x7FFF;
-
- ret = write_retry(fd, outblk->data, count + 2);
-
- if (ret < 0) {
- perror("writing meta data block");
- return -1;
- }
-
- if ((size_t)ret < count) {
- fputs("meta data written to file was truncated\n", stderr);
- return -1;
- }
+ size_t count = le16toh(((uint16_t *)outblk->data)[0]) & 0x7FFF;
- return 0;
+ return write_data("writing meta data block", fd,
+ outblk->data, count + 2);
}
meta_writer_t *meta_writer_create(int fd, compressor_t *cmp, bool keep_in_mem)