aboutsummaryrefslogtreecommitdiff
path: root/tar/sqfs2tar.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 /tar/sqfs2tar.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 'tar/sqfs2tar.c')
-rw-r--r--tar/sqfs2tar.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c
index 110c8c4..15c0363 100644
--- a/tar/sqfs2tar.c
+++ b/tar/sqfs2tar.c
@@ -161,23 +161,11 @@ out_exit:
static int terminate_archive(void)
{
char buffer[1024];
- ssize_t ret;
memset(buffer, '\0', sizeof(buffer));
- ret = write_retry(STDOUT_FILENO, buffer, sizeof(buffer));
-
- if (ret < 0) {
- perror("adding archive terminator");
- return -1;
- }
-
- if ((size_t)ret < sizeof(buffer)) {
- fputs("adding archive terminator: truncated write\n", stderr);
- return -1;
- }
-
- return 0;
+ return write_data("adding archive terminator", STDOUT_FILENO,
+ buffer, sizeof(buffer));
}
static int write_tree_dfs(fstree_t *fs, tree_node_t *n, data_reader_t *data)