From: Sami Kerola Date: Sat, 13 Apr 2013 19:54:54 +0000 (+0100) Subject: mkfs.cramfs: unify write check to a file descriptor X-Git-Tag: v2.24-rc1~586 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=393fb46501daa199b27a4bc534ca6d2aad1f2b3d;p=thirdparty%2Futil-linux.git mkfs.cramfs: unify write check to a file descriptor Signed-off-by: Sami Kerola --- diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c index b5edb7a4b5..cb3e65758b 100644 --- a/disk-utils/mkfs.cramfs.c +++ b/disk-utils/mkfs.cramfs.c @@ -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