summaryrefslogtreecommitdiff
path: root/cmds-inspect-dump-tree.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 /cmds-inspect-dump-tree.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 'cmds-inspect-dump-tree.c')
-rw-r--r--cmds-inspect-dump-tree.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
index d84d52dd..563b4e37 100644
--- a/cmds-inspect-dump-tree.c
+++ b/cmds-inspect-dump-tree.c
@@ -313,12 +313,13 @@ int cmd_inspect_dump_tree(int argc, char **argv)
ret = check_arg_type(argv[optind]);
if (ret != BTRFS_ARG_BLKDEV && ret != BTRFS_ARG_REG) {
- if (ret < 0)
- error("invalid argument %s: %s", argv[optind],
- strerror(-ret));
- else
+ if (ret < 0) {
+ errno = -ret;
+ error("invalid argument %s: %m", argv[optind]);
+ } else {
error("not a block device or regular file: %s",
argv[optind]);
+ }
goto out;
}
@@ -432,9 +433,9 @@ again:
key.type = BTRFS_ROOT_ITEM_KEY;
ret = btrfs_search_slot(NULL, tree_root_scan, &key, &path, 0, 0);
if (ret < 0) {
- error("cannot read ROOT_ITEM from tree %llu: %s",
- (unsigned long long)tree_root_scan->root_key.objectid,
- strerror(-ret));
+ errno = -ret;
+ error("cannot read ROOT_ITEM from tree %llu: %m",
+ (unsigned long long)tree_root_scan->root_key.objectid);
goto close_root;
}
while (1) {