[PATCH 17/33] fdformat: check writing to a file descriptor was successful

Sami Kerola
2013-04-13T19:55:55Z

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

diff --git a/disk-utils/fdformat.c b/disk-utils/fdformat.c
index 509a605..b50ba30 100644
--- a/disk-utils/fdformat.c
+++ b/disk-utils/fdformat.c
@@ -159,7 +159,8 @@ int main(int argc, char **argv)
(param.head == 2) ? _("Double") : _("Single"),
param.track, param.sect, param.size >> 1);
format_disk(ctrl);
- close(ctrl);
+ if (close_fd(ctrl) != 0)
+ err(EXIT_FAILURE, _("write failed"));

if (verify)
verify_disk(argv[0]);
--
1.8.2.1