summaryrefslogtreecommitdiff
path: root/btrfs-corrupt-block.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-10-25 14:10:54 +0200
committerDavid Sterba <dsterba@suse.com>2018-10-31 18:24:14 +0100
commite578b59bf612178d7727c303102049e62676c308 (patch)
treea6d6edd7fb6f34f4ce753aa9a1d787198a0e1ddf /btrfs-corrupt-block.c
parentd59e19ca0786be2b415ca342b0fab5f222ecb702 (diff)
btrfs-progs: convert strerror to implicit %m
Similar to the changes where strerror(errno) was converted, continue with the remaining cases where the argument was stored in another variable. The savings in object size are about 4500 bytes: $ size btrfs.old btrfs.new text data bss dec hex filename 805055 24248 19748 849051 cf49b btrfs.old 804527 24248 19748 848523 cf28b btrfs.new Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-corrupt-block.c')
-rw-r--r--btrfs-corrupt-block.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
index 3add8e63..ba467921 100644
--- a/btrfs-corrupt-block.c
+++ b/btrfs-corrupt-block.c
@@ -70,9 +70,9 @@ static int debug_corrupt_block(struct extent_buffer *eb,
if (!copy || mirror_num == copy) {
ret = read_extent_from_disk(eb, 0, eb->len);
if (ret < 0) {
- error("cannot read eb bytenr %llu: %s",
- (unsigned long long)eb->dev_bytenr,
- strerror(-ret));
+ errno = -ret;
+ error("cannot read eb bytenr %llu: %m",
+ (unsigned long long)eb->dev_bytenr);
return ret;
}
printf("corrupting %llu copy %d\n", eb->start,
@@ -80,9 +80,9 @@ static int debug_corrupt_block(struct extent_buffer *eb,
memset(eb->data, 0, eb->len);
ret = write_extent_to_disk(eb);
if (ret < 0) {
- error("cannot write eb bytenr %llu: %s",
- (unsigned long long)eb->dev_bytenr,
- strerror(-ret));
+ errno = -ret;
+ error("cannot write eb bytenr %llu: %m",
+ (unsigned long long)eb->dev_bytenr);
return ret;
}
fsync(eb->fd);