projects
/
platform
/
upstream
/
btrfs-progs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2490de5
)
btrfs-progs: improve error messages after failed wiping
author
David Sterba
<dsterba@suse.com>
Mon, 14 Mar 2016 13:18:32 +0000
(14:18 +0100)
committer
David Sterba
<dsterba@suse.com>
Mon, 14 Mar 2016 13:18:32 +0000
(14:18 +0100)
Signed-off-by: David Sterba <dsterba@suse.com>
utils.c
patch
|
blob
|
history
diff --git
a/utils.c
b/utils.c
index
77f0f68
..
f22e329
100644
(file)
--- a/
utils.c
+++ b/
utils.c
@@
-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);