[PATCH 26/33] mkfs.cramfs: unify write check to a file descriptor

Sami Kerola
2013-04-13T19:56:20Z

disk-utils/mkfs.cramfs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
index b5edb7a..cb3e657 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
--
1.8.2.1