From dded8d35e89cf340121bcde5ead54bbd43b91d03 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 20 May 2013 13:10:52 +0200 Subject: [PATCH] sfdisk: don't call BLKRRPART for non-block devices Reported-by: Bertrand Jacquin Signed-off-by: Karel Zak --- fdisks/sfdisk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fdisks/sfdisk.c b/fdisks/sfdisk.c index 3206a6bac3..4df64b8433 100644 --- a/fdisks/sfdisk.c +++ b/fdisks/sfdisk.c @@ -780,15 +780,17 @@ reread_ioctl(int fd) { /* reread after writing */ static int reread_disk_partition(char *dev, int fd) { - printf(_("Re-reading the partition table ...\n")); fflush(stdout); sync(); - if (reread_ioctl(fd) && is_blkdev(fd)) { - warnx(_("The command to re-read the partition table failed.\n" + if (is_blkdev(fd)) { + printf(_("Re-reading the partition table ...\n")); + if (reread_ioctl(fd) ) { + warnx(_("The command to re-read the partition table failed.\n" "Run partprobe(8), kpartx(8) or reboot your system now,\n" "before using mkfs\n")); - return 0; + return 0; + } } if (fsync(fd) || close(fd)) { -- 2.47.3