diff options
author | David Sterba <dsterba@suse.com> | 2016-03-14 14:18:32 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-03-14 14:18:32 +0100 |
commit | 230bb91aa816fb2fa6d9cbc068595acdf6e13813 (patch) | |
tree | c334ea3e1a4904d2def87b885db80cc7d5171596 | |
parent | 2490de5da527969a9178418155120bf50f2a8421 (diff) |
btrfs-progs: improve error messages after failed wiping
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | utils.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -842,8 +842,11 @@ static int btrfs_wipe_existing_sb(int fd) memset(buf, 0, len); ret = pwrite(fd, buf, len, offset); - if (ret != len) { - fprintf(stderr, "ERROR: cannot wipe existing superblock\n"); + if (ret < 0) { + error("cannot wipe existing superblock: %s", strerror(errno)); + ret = -1; + } else if (ret != len) { + error("cannot wipe existing superblock: wrote %d of %zd", ret, len); ret = -1; } fsync(fd); |