summaryrefslogtreecommitdiffstats
path: root/misc-utils/wipefs.c
diff options
context:
space:
mode:
authorKarel Zak2010-02-04 21:18:34 +0100
committerKarel Zak2010-02-04 21:18:34 +0100
commit269c1a2a6407a20e52aea4f4814d12655ff06e09 (patch)
treeab78a1bfd791015fc2be665b87d07f976fc17bff /misc-utils/wipefs.c
parentchrt: add --reset-on-fork (diff)
downloadkernel-qcow2-util-linux-269c1a2a6407a20e52aea4f4814d12655ff06e09.tar.gz
kernel-qcow2-util-linux-269c1a2a6407a20e52aea4f4814d12655ff06e09.tar.xz
kernel-qcow2-util-linux-269c1a2a6407a20e52aea4f4814d12655ff06e09.zip
wipefs: ignore devices with partition table
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/wipefs.c')
-rw-r--r--misc-utils/wipefs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index a59b5d726..f735065d7 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -190,13 +190,27 @@ static struct wipe_desc *
read_offsets(struct wipe_desc *wp, const char *fname, int zap)
{
blkid_probe pr;
+ int rc;
if (!fname)
return NULL;
pr = blkid_new_probe_from_filename(fname);
if (!pr)
- errx(EXIT_FAILURE, _("probing initialization failed"));
+ errx(EXIT_FAILURE, _("error: %s: probing initialization failed"), fname);
+
+ blkid_probe_enable_superblocks(pr, 0); /* enabled by default ;-( */
+
+ blkid_probe_enable_partitions(pr, 1);
+ rc = blkid_do_fullprobe(pr);
+ blkid_probe_enable_partitions(pr, 0);
+
+ if (rc == 0) {
+ const char *type = NULL;
+ blkid_probe_lookup_value(pr, "PTTYPE", &type, NULL);
+ errx(EXIT_FAILURE, _("error: %s: appears to contain '%s' "
+ "partition table"), fname, type);
+ }
blkid_probe_enable_superblocks(pr, 1);
blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_MAGIC |