|
|
05ad79 |
From df6302339ae99535d3c075712db8cadeedbb6c00 Mon Sep 17 00:00:00 2001
|
|
|
05ad79 |
From: Karel Zak <kzak@redhat.com>
|
|
|
05ad79 |
Date: Tue, 17 Oct 2017 11:07:56 +0200
|
|
|
05ad79 |
Subject: [PATCH 137/141] wipefs: fix -t filter
|
|
|
05ad79 |
|
|
|
05ad79 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1486777
|
|
|
05ad79 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
05ad79 |
---
|
|
|
05ad79 |
misc-utils/wipefs.c | 15 ++++++++++++---
|
|
|
05ad79 |
1 file changed, 12 insertions(+), 3 deletions(-)
|
|
|
05ad79 |
|
|
|
05ad79 |
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
|
|
|
05ad79 |
index 0144c9ef8..a0852aa97 100644
|
|
|
05ad79 |
--- a/misc-utils/wipefs.c
|
|
|
05ad79 |
+++ b/misc-utils/wipefs.c
|
|
|
05ad79 |
@@ -162,13 +162,16 @@ clone_offset(struct wipe_desc *wp0)
|
|
|
05ad79 |
}
|
|
|
05ad79 |
|
|
|
05ad79 |
static struct wipe_desc *
|
|
|
05ad79 |
-get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr)
|
|
|
05ad79 |
+get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr, int *found)
|
|
|
05ad79 |
{
|
|
|
05ad79 |
const char *off, *type, *mag, *p, *usage = NULL;
|
|
|
05ad79 |
size_t len;
|
|
|
05ad79 |
loff_t offset;
|
|
|
05ad79 |
int rc, ispt = 0;
|
|
|
05ad79 |
|
|
|
05ad79 |
+ if (found)
|
|
|
05ad79 |
+ *found = 0;
|
|
|
05ad79 |
+
|
|
|
05ad79 |
/* superblocks */
|
|
|
05ad79 |
if (blkid_probe_lookup_value(pr, "TYPE", &type, NULL) == 0) {
|
|
|
05ad79 |
rc = blkid_probe_lookup_value(pr, "SBMAGIC_OFFSET", &off, NULL);
|
|
|
05ad79 |
@@ -215,6 +218,8 @@ get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr)
|
|
|
05ad79 |
if (blkid_probe_lookup_value(pr, "UUID", &p, NULL) == 0)
|
|
|
05ad79 |
wp->uuid = xstrdup(p);
|
|
|
05ad79 |
|
|
|
05ad79 |
+ if (found)
|
|
|
05ad79 |
+ *found = 1;
|
|
|
05ad79 |
return wp;
|
|
|
05ad79 |
}
|
|
|
05ad79 |
|
|
|
05ad79 |
@@ -266,7 +271,7 @@ read_offsets(struct wipe_desc *wp, const char *devname)
|
|
|
05ad79 |
return NULL;
|
|
|
05ad79 |
|
|
|
05ad79 |
while (blkid_do_probe(pr) == 0) {
|
|
|
05ad79 |
- wp = get_desc_for_probe(wp, pr);
|
|
|
05ad79 |
+ wp = get_desc_for_probe(wp, pr, NULL);
|
|
|
05ad79 |
if (!wp)
|
|
|
05ad79 |
break;
|
|
|
05ad79 |
}
|
|
|
05ad79 |
@@ -347,9 +352,13 @@ do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet
|
|
|
05ad79 |
wp0 = clone_offset(wp);
|
|
|
05ad79 |
|
|
|
05ad79 |
while (blkid_do_probe(pr) == 0) {
|
|
|
05ad79 |
- wp = get_desc_for_probe(wp, pr);
|
|
|
05ad79 |
+ int found = 0;
|
|
|
05ad79 |
+
|
|
|
05ad79 |
+ wp = get_desc_for_probe(wp, pr, &found);
|
|
|
05ad79 |
if (!wp)
|
|
|
05ad79 |
break;
|
|
|
05ad79 |
+ if (!found)
|
|
|
05ad79 |
+ continue;
|
|
|
05ad79 |
|
|
|
05ad79 |
/* Check if offset is in provided list */
|
|
|
05ad79 |
w = wp0;
|
|
|
05ad79 |
--
|
|
|
05ad79 |
2.13.6
|
|
|
05ad79 |
|