summaryrefslogtreecommitdiff
path: root/cmds-subvolume.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-subvolume.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-subvolume.c')
-rw-r--r--cmds-subvolume.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 5a446c1..a8395aa 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -136,7 +136,8 @@ static int cmd_subvol_create(int argc, char **argv)
retval = 1; /* failure */
res = test_isdir(dst);
if (res < 0 && res != -ENOENT) {
- error("cannot access %s: %s", dst, strerror(-res));
+ errno = -res;
+ error("cannot access %s: %m", dst);
goto out;
}
if (res >= 0) {
@@ -337,8 +338,8 @@ again:
} else if (commit_mode == COMMIT_AFTER) {
res = get_fsid(dname, fsid, 0);
if (res < 0) {
- error("unable to get fsid for '%s': %s",
- path, strerror(-res));
+ errno = -res;
+ error("unable to get fsid for '%s': %m", path);
error(
"delete succeeded but commit may not be done in the end");
ret = 1;
@@ -690,7 +691,8 @@ static int cmd_subvol_snapshot(int argc, char **argv)
res = test_isdir(dst);
if (res < 0 && res != -ENOENT) {
- error("cannot access %s: %s", dst, strerror(-res));
+ errno = -res;
+ error("cannot access %s: %m", dst);
goto out;
}
if (res == 0) {