[PATCH 20/33] cfdisk: check writing to a file descriptor was successful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 fdisks/cfdisk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fdisks/cfdisk.c b/fdisks/cfdisk.c
index dcaa05d..e685f71 100644
--- a/fdisks/cfdisk.c
+++ b/fdisks/cfdisk.c
@@ -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"));
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux