From bfd876dbf151df164b4d87de20aec39b24f205f9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 16 Jul 2019 19:29:27 +0200 Subject: 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 --- lib/sqfs/table.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'lib/sqfs/table.c') diff --git a/lib/sqfs/table.c b/lib/sqfs/table.c index fb6bddc..81e7691 100644 --- a/lib/sqfs/table.c +++ b/lib/sqfs/table.c @@ -15,7 +15,6 @@ int sqfs_write_table(int outfd, sqfs_super_t *super, const void *data, size_t i, blkidx = 0, tblsize; meta_writer_t *m; uint32_t offset; - ssize_t ret; /* Write actual data. Whenever we cross a block boundary, remember the block start offset */ @@ -49,16 +48,8 @@ int sqfs_write_table(int outfd, sqfs_super_t *super, const void *data, *startblock = super->bytes_used; tblsize = sizeof(blocks[0]) * blkidx; - ret = write_retry(outfd, blocks, tblsize); - if (ret < 0) { - perror("writing index table"); + if (write_data("writing table index", outfd, blocks, tblsize)) return -1; - } - - if ((size_t)ret < tblsize) { - fputs("index table truncated\n", stderr); - return -1; - } super->bytes_used += tblsize; return 0; -- cgit v1.2.3