aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/super.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/super.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/super.c')
-rw-r--r--lib/sqfs/super.c13
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, &copy, sizeof(copy));
-
- if (ret < 0) {
- perror("squashfs writing super block");
+ if (write_data("writing super block", fd, &copy, 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;