[PATCH 30/33] fallocate: check writing to a file descriptor was successful

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

sys-utils/fallocate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index ff0f9e6..6a87673 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -168,6 +168,7 @@ int main(int argc, char **argv)
err(EXIT_FAILURE, _("%s: fallocate failed"), fname);
}

- close(fd);
+ if (close_fd(fd) != 0)
+ err(EXIT_FAILURE, _("write failed: %s"), fname);
return EXIT_SUCCESS;
}
--
1.8.2.1