summaryrefslogtreecommitdiffstats
path: root/misc-utils/wipefs.c
diff options
context:
space:
mode:
authorKarel Zak2013-03-27 16:34:11 +0100
committerKarel Zak2013-03-27 16:34:11 +0100
commit05ba8c8483a3a2b35989d1059a3dbf1612c0e6e4 (patch)
treee3ded73dd9681ad92d621b31249c20cdc23650e4 /misc-utils/wipefs.c
parentrename: fix memory leak [coverity scan] (diff)
downloadkernel-qcow2-util-linux-05ba8c8483a3a2b35989d1059a3dbf1612c0e6e4.tar.gz
kernel-qcow2-util-linux-05ba8c8483a3a2b35989d1059a3dbf1612c0e6e4.tar.xz
kernel-qcow2-util-linux-05ba8c8483a3a2b35989d1059a3dbf1612c0e6e4.zip
wipefs: make do_wipe() more readable [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/wipefs.c')
-rw-r--r--misc-utils/wipefs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index 156f2143d..ce3d2b816 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -314,7 +314,7 @@ do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet
{
int flags;
blkid_probe pr;
- struct wipe_desc *w, *wp0 = clone_offset(wp);
+ struct wipe_desc *w, *wp0;
int zap = all ? 1 : wp->zap;
flags = O_RDWR;
@@ -324,6 +324,8 @@ do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet
if (!pr)
return NULL;
+ wp0 = clone_offset(wp);
+
while (blkid_do_probe(pr) == 0) {
wp = get_desc_for_probe(wp, pr);
if (!wp)