summaryrefslogtreecommitdiffstats
path: root/disk-utils/sfdisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'disk-utils/sfdisk.c')
-rw-r--r--disk-utils/sfdisk.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index fb9fa499a..c6d57eacc 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -1390,9 +1390,9 @@ static size_t last_pt_partno(struct sfdisk *sf)
return partno;
}
+#ifdef BLKRRPART
static int is_device_used(struct sfdisk *sf)
{
-#ifdef BLKRRPART
struct stat st;
int fd;
@@ -1406,9 +1406,14 @@ static int is_device_used(struct sfdisk *sf)
if (fstat(fd, &st) == 0 && S_ISBLK(st.st_mode)
&& major(st.st_rdev) != LOOPDEV_MAJOR)
return ioctl(fd, BLKRRPART) != 0;
-#endif
return 0;
}
+#else
+static int is_device_used(struct sfdisk *sf __attribute__((__unused__)))
+{
+ return 0;
+}
+#endif
#ifdef HAVE_LIBREADLINE
static char *sfdisk_fgets(struct fdisk_script *dp,