6717ab
diff -up util-linux-2.23.2/misc-utils/wipefs.8.kzak util-linux-2.23.2/misc-utils/wipefs.8
6717ab
--- util-linux-2.23.2/misc-utils/wipefs.8.kzak	2014-09-24 10:41:31.061930168 +0200
6717ab
+++ util-linux-2.23.2/misc-utils/wipefs.8	2014-09-24 10:46:30.142783728 +0200
6717ab
@@ -37,6 +37,11 @@ table will still be visible by another m
6717ab
 When used with option \fB-a\fR, all magic strings that are visible for libblkid are
6717ab
 erased.
6717ab
 
6717ab
+Note that by default
6717ab
+.B wipefs
6717ab
+does not erase nested partition tables on non-whole disk devices. The option 
6717ab
+\-\-force is required.
6717ab
+
6717ab
 .SH OPTIONS
6717ab
 .TP
6717ab
 .BR \-a , " \-\-all"
6717ab
diff -up util-linux-2.23.2/misc-utils/wipefs.c.kzak util-linux-2.23.2/misc-utils/wipefs.c
6717ab
--- util-linux-2.23.2/misc-utils/wipefs.c.kzak	2014-09-24 10:41:31.061930168 +0200
6717ab
+++ util-linux-2.23.2/misc-utils/wipefs.c	2014-09-24 10:50:07.728859738 +0200
6717ab
@@ -332,7 +332,7 @@ static void rereadpt(int fd, const char
6717ab
 static struct wipe_desc *
6717ab
 do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet, int force)
6717ab
 {
6717ab
-	int flags, reread = 0;
6717ab
+	int flags, reread = 0, need_force = 0;
6717ab
 	blkid_probe pr;
6717ab
 	struct wipe_desc *w, *wp0;
6717ab
 	int zap = all ? 1 : wp->zap;
6717ab
@@ -365,6 +365,15 @@ do_wipe(struct wipe_desc *wp, const char
6717ab
 		if (!wp->on_disk)
6717ab
 			continue;
6717ab
 
6717ab
+		if (!force
6717ab
+		    && wp->is_parttable
6717ab
+		    && !blkid_probe_is_wholedisk(pr)) {
6717ab
+			warnx(_("%s: ignore nested \"%s\" partition "
6717ab
+				"table on non-whole disk device."), devname, wp->type);
6717ab
+			need_force = 1;
6717ab
+			continue;
6717ab
+		}
6717ab
+
6717ab
 		if (zap) {
6717ab
 			do_wipe_real(pr, devname, wp, noact, quiet);
6717ab
 			if (wp->is_parttable)
6717ab
@@ -377,6 +386,9 @@ do_wipe(struct wipe_desc *wp, const char
6717ab
 			warnx(_("%s: offset 0x%jx not found"), devname, w->offset);
6717ab
 	}
6717ab
 
6717ab
+	if (need_force)
6717ab
+		warnx(_("Use the --force option to force erase."));
6717ab
+
6717ab
 	fsync(blkid_probe_get_fd(pr));
6717ab
 
6717ab
 	if (reread)