summaryrefslogtreecommitdiffstats
path: root/disk-utils/fdisk-list.c
diff options
context:
space:
mode:
authorKarel Zak2014-09-11 15:28:15 +0200
committerKarel Zak2014-10-07 14:55:31 +0200
commitd2c47697e149d406af266c9d59f140c24ee890ad (patch)
tree230bf7352d6abaa2770699063b5c3bb5a9a39e84 /disk-utils/fdisk-list.c
parentsfdisk: add --list-types (diff)
downloadkernel-qcow2-util-linux-d2c47697e149d406af266c9d59f140c24ee890ad.tar.gz
kernel-qcow2-util-linux-d2c47697e149d406af266c9d59f140c24ee890ad.tar.xz
kernel-qcow2-util-linux-d2c47697e149d406af266c9d59f140c24ee890ad.zip
sfdisk: add --verify
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fdisk-list.c')
-rw-r--r--disk-utils/fdisk-list.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c
index 3d26f8b7a..708e6939a 100644
--- a/disk-utils/fdisk-list.c
+++ b/disk-utils/fdisk-list.c
@@ -220,7 +220,7 @@ char *next_proc_partition(FILE **f)
return NULL;
}
-int print_device_pt(struct fdisk_context *cxt, char *device, int warnme)
+int print_device_pt(struct fdisk_context *cxt, char *device, int warnme, int verify)
{
if (fdisk_assign_device(cxt, device, 1) != 0) { /* read-only */
if (warnme || errno == EACCES)
@@ -230,14 +230,16 @@ int print_device_pt(struct fdisk_context *cxt, char *device, int warnme)
list_disk_geometry(cxt);
- if (fdisk_has_label(cxt))
+ if (fdisk_has_label(cxt)) {
list_disklabel(cxt);
-
+ if (verify)
+ fdisk_verify_disklabel(cxt);
+ }
fdisk_deassign_device(cxt, 1);
return 0;
}
-void print_all_devices_pt(struct fdisk_context *cxt)
+void print_all_devices_pt(struct fdisk_context *cxt, int verify)
{
FILE *f = NULL;
int ct = 0;
@@ -246,7 +248,7 @@ void print_all_devices_pt(struct fdisk_context *cxt)
while ((dev = next_proc_partition(&f))) {
if (ct)
fputs("\n\n", stdout);
- if (print_device_pt(cxt, dev, 0) == 0)
+ if (print_device_pt(cxt, dev, 0, verify) == 0)
ct++;
free(dev);
}