]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: don't call BLKRRPART for non-block devices
authorKarel Zak <kzak@redhat.com>
Mon, 20 May 2013 11:10:52 +0000 (13:10 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 20 May 2013 11:10:52 +0000 (13:10 +0200)
Reported-by: Bertrand Jacquin <beber@meleeweb.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/sfdisk.c

index 27f62d8162d772e521000269d4826bd8a54b42f1..e639dadebe389cad75ffad2811ac1a6e7d19ab65 100644 (file)
@@ -787,15 +787,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 (close_fd(fd) != 0) {