From e578b59bf612178d7727c303102049e62676c308 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 25 Oct 2018 14:10:54 +0200 Subject: 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 --- cmds-restore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmds-restore.c') diff --git a/cmds-restore.c b/cmds-restore.c index d12c1a92..7a763018 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -1542,8 +1542,8 @@ int cmd_restore(int argc, char **argv) } if ((ret = check_mounted(argv[optind])) < 0) { - fprintf(stderr, "Could not check mount status: %s\n", - strerror(-ret)); + errno = -ret; + fprintf(stderr, "Could not check mount status: %m\n"); return 1; } else if (ret) { fprintf(stderr, "%s is currently mounted. Aborting.\n", argv[optind]); @@ -1591,8 +1591,9 @@ int cmd_restore(int argc, char **argv) key.offset = (u64)-1; root = btrfs_read_fs_root(orig_root->fs_info, &key); if (IS_ERR(root)) { - fprintf(stderr, "fail to read root %llu: %s\n", - root_objectid, strerror(-PTR_ERR(root))); + errno = -PTR_ERR(root); + fprintf(stderr, "fail to read root %llu: %m\n", + root_objectid); root = orig_root; ret = 1; goto out; -- cgit v1.2.3