]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
cfdisk: check writing to a file descriptor was successful
authorSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2013 19:54:48 +0000 (20:54 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 26 Apr 2013 11:26:06 +0000 (13:26 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fdisks/cfdisk.c

index a68f855a4ec95abb9b75f125881ee9d8769140e5..3fcc5d82dff13593ad0ae9a0616d96dabd9f6bcf 100644 (file)
@@ -406,8 +406,12 @@ static void
 fdexit(int ret) {
     if (opened) {
        if (changed)
-               fsync(fd);
-       close(fd);
+           if (close_fd(fd) != 0) {
+               fprintf(stderr, _("write failed\n"));
+               exit(2);
+           }
+       else
+           close(fd);
     }
     if (changed) {
        fprintf(stderr, _("Disk has been changed.\n"));