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/super.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/super.c')
-rw-r--r-- | lib/sqfs/super.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/sqfs/super.c b/lib/sqfs/super.c index d3b79c6..59eb366 100644 --- a/lib/sqfs/super.c +++ b/lib/sqfs/super.c @@ -47,7 +47,6 @@ int sqfs_super_init(sqfs_super_t *super, size_t block_size, uint32_t mtime, int sqfs_super_write(sqfs_super_t *super, int fd) { sqfs_super_t copy; - ssize_t ret; copy.magic = htole32(super->magic); copy.inode_count = htole32(super->inode_count); @@ -72,18 +71,8 @@ int sqfs_super_write(sqfs_super_t *super, int fd) if (lseek(fd, 0, SEEK_SET) == (off_t)-1) goto fail_seek; - ret = write_retry(fd, ©, sizeof(copy)); - - if (ret < 0) { - perror("squashfs writing super block"); + if (write_data("writing super block", fd, ©, sizeof(copy))) return -1; - } - - if ((size_t)ret < sizeof(copy)) { - fputs("squashfs writing super block: truncated write\n", - stderr); - return -1; - } if (lseek(fd, 0, SEEK_END) == (off_t)-1) goto fail_seek; |