summaryrefslogtreecommitdiff
path: root/cmds-fi-du.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-fi-du.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-fi-du.c')
-rw-r--r--cmds-fi-du.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmds-fi-du.c b/cmds-fi-du.c
index 4e639f6d..496a55b8 100644
--- a/cmds-fi-du.c
+++ b/cmds-fi-du.c
@@ -406,9 +406,10 @@ static int du_walk_dir(struct du_dir_ctxt *ctxt, struct rb_root *shared_extents)
ret = 0;
continue;
} else if (ret) {
+ errno = -ret;
fprintf(stderr,
- "failed to walk dir/file: %s :%s\n",
- entry->d_name, strerror(-ret));
+ "failed to walk dir/file: %s : %m\n",
+ entry->d_name);
break;
}
@@ -601,8 +602,8 @@ int cmd_filesystem_du(int argc, char **argv)
for (i = optind; i < argc; i++) {
ret = du_add_file(argv[i], AT_FDCWD, NULL, NULL, NULL, 1);
if (ret) {
- error("cannot check space of '%s': %s", argv[i],
- strerror(-ret));
+ errno = -ret;
+ error("cannot check space of '%s': %m", argv[i]);
err = 1;
}