diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2013-09-04 23:22:23 +0800 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-10-16 08:20:41 -0400 |
commit | c0a7cbf03c71b773740263da31ed7028071e516a (patch) | |
tree | 66853cee6425d3d811e7177900ca5e0664efc8d1 /cmds-filesystem.c | |
parent | d57dff4183c40833a92f8851f5ea427c6a3c4e36 (diff) |
Btrfs-progs: fix magic return value in cmds-filesystem.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r-- | cmds-filesystem.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c index ca0855bd..815d59a5 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -62,12 +62,14 @@ static int cmd_df(int argc, char **argv) fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access to '%s'\n", path); - return 12; + return 1; } sargs_orig = sargs = malloc(sizeof(struct btrfs_ioctl_space_args)); - if (!sargs) - return -ENOMEM; + if (!sargs) { + ret = -ENOMEM; + goto out; + } sargs->space_slots = 0; sargs->total_spaces = 0; @@ -157,7 +159,7 @@ out: close_file_or_dir(fd, dirstream); free(sargs); - return 0; + return !!ret; } static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search) @@ -248,7 +250,7 @@ static int cmd_show(int argc, char **argv) if (ret){ fprintf(stderr, "ERROR: error %d while scanning\n", ret); - return 18; + return 1; } if(searchstart < argc) @@ -286,7 +288,7 @@ static int cmd_sync(int argc, char **argv) fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access to '%s'\n", path); - return 12; + return 1; } printf("FSSync '%s'\n", path); @@ -296,7 +298,7 @@ static int cmd_sync(int argc, char **argv) if( res < 0 ){ fprintf(stderr, "ERROR: unable to fs-syncing '%s' - %s\n", path, strerror(e)); - return 16; + return 1; } return 0; @@ -429,12 +431,10 @@ static int cmd_defrag(int argc, char **argv) } if (verbose) printf("%s\n", BTRFS_BUILD_VERSION); - if (errors) { + if (errors) fprintf(stderr, "total %d failures\n", errors); - exit(1); - } - return errors; + return !!errors; } static const char * const cmd_resize_usage[] = { @@ -462,13 +462,13 @@ static int cmd_resize(int argc, char **argv) if (len == 0 || len >= BTRFS_VOL_NAME_MAX) { fprintf(stderr, "ERROR: size value too long ('%s)\n", amount); - return 14; + return 1; } fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access to '%s'\n", path); - return 12; + return 1; } printf("Resize '%s' of '%s'\n", path, amount); @@ -479,7 +479,7 @@ static int cmd_resize(int argc, char **argv) if( res < 0 ){ fprintf(stderr, "ERROR: unable to resize '%s' - %s\n", path, strerror(e)); - return 30; + return 1; } return 0; } |