]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wipefs: make do_wipe() more readable [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 15:34:11 +0000 (16:34 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 15:34:11 +0000 (16:34 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/wipefs.c

index 156f2143da316d1d7af1c2a42fac91e9824e5caa..ce3d2b816b38be3f6e0beece0bbbec6ab1f16eb0 100644 (file)
@@ -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)