]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkfs.cramfs: unify write check to a file descriptor
authorSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2013 19:54:54 +0000 (20:54 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 26 Apr 2013 11:26:07 +0000 (13:26 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/mkfs.cramfs.c

index b5edb7a4b5566774dc98d94860c2db69e97525da..cb3e65758b16efef6a4fe522f817b7b08c91b390 100644 (file)
@@ -879,12 +879,11 @@ int main(int argc, char **argv)
                        (long long) fslen_ub, offset);
 
        written = write(fd, rom_image, offset);
-       close(fd);
-       if (written < 0)
-               err(MKFS_EX_ERROR, _("ROM image"));
        if (offset != written)
                errx(MKFS_EX_ERROR, _("ROM image write failed (%zd %zd)"),
                        written, offset);
+       if (close_fd(fd) != 0)
+               err(MKFS_EX_ERROR, _("ROM image"));
 
        /*
         * (These warnings used to come at the start, but they scroll off