summaryrefslogtreecommitdiff
path: root/cmds-rescue.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-rescue.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-rescue.c')
-rw-r--r--cmds-rescue.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmds-rescue.c b/cmds-rescue.c
index 38c4ab9b..2bc50c08 100644
--- a/cmds-rescue.c
+++ b/cmds-rescue.c
@@ -77,7 +77,8 @@ static int cmd_rescue_chunk_recover(int argc, char *argv[])
ret = check_mounted(file);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
return 1;
} else if (ret) {
error("the device is busy");
@@ -142,7 +143,8 @@ static int cmd_rescue_super_recover(int argc, char **argv)
dname = argv[optind];
ret = check_mounted(dname);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
return 1;
} else if (ret) {
error("the device is busy");
@@ -175,7 +177,8 @@ static int cmd_rescue_zero_log(int argc, char **argv)
devname = argv[optind];
ret = check_mounted(devname);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
goto out;
} else if (ret) {
error("%s is currently mounted", devname);
@@ -226,7 +229,8 @@ static int cmd_rescue_fix_device_size(int argc, char **argv)
devname = argv[optind];
ret = check_mounted(devname);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
goto out;
} else if (ret) {
error("%s is currently mounted", devname);