From: Bryn M. Reeves Date: Thu, 18 Feb 2010 20:39:22 +0000 (+0100) Subject: sfdisk: make sure writes make it to disk in write_partitions() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ac78ead3c02660a894ca7e7a4887ce80ebe2b50;p=util-linux sfdisk: make sure writes make it to disk in write_partitions() Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=565946 Signed-off-by: Bryn M. Reeves Signed-off-by: Karel Zak --- diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 6ac91f07..6432b25c 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -1637,6 +1637,11 @@ write_partitions(char *dev, int fd, struct disk_desc *z) { error(_("Failed writing the partition on %s\n"), dev); return 0; } + if (fsync(fd)) { + perror(dev); + error(_("Failed writing the partition on %s\n"), dev); + return 0; + } return 1; }