]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wipefs: exit on failed erase
authorKarel Zak <kzak@redhat.com>
Wed, 21 Jun 2017 08:53:28 +0000 (10:53 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 23 Jun 2017 13:25:53 +0000 (15:25 +0200)
The current behavior is to report error and continue, it seems strange:

# blockdev --setro /dev/sdc

# wipefs -a /dev/sdc
wipefs: /dev/sdc: failed to erase xfs magic string at offset 0x00000000: Operation not permitted
/dev/sdc: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
                          ^^^^^^^^^^^
                           not true

The patch calls err() to exit.

Reported-by: Vratislav Podzimek <vpodzime@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/wipefs.c

index e07ce18e3456f1995bf600ffa66c69a08231c80d..209ed7147b3520e048df9baa8bea713f304fb8d2 100644 (file)
@@ -310,7 +310,7 @@ static void do_wipe_real(blkid_probe pr, const char *devname,
        size_t i;
 
        if (blkid_do_wipe(pr, (flags & WP_FL_NOACT) != 0))
-               warn(_("%s: failed to erase %s magic string at offset 0x%08jx"),
+               err(EXIT_FAILURE, _("%s: failed to erase %s magic string at offset 0x%08jx"),
                     devname, w->type, (intmax_t)w->offset);
 
        if (flags & WP_FL_QUIET)