summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-11-12 13:41:42 +0000
committerChris Mason <clm@fb.com>2014-01-31 08:22:02 -0800
commit457b1286dd9976efbfec25bb286ddc8cec410aa1 (patch)
tree517affec64c49ccdb548beba5e4db3bb03923bbf /cmds-filesystem.c
parent67d3c3c0d3505377e6468849b086aefc69ae5411 (diff)
Btrfs-progs: let get_label return the label instead of printing it
get_label prints the label at the moment. Change this so that the label is returned and printing is done by the caller. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index ef426d30..67834389 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -896,10 +896,18 @@ static int cmd_label(int argc, char **argv)
if (check_argc_min(argc, 2) || check_argc_max(argc, 3))
usage(cmd_label_usage);
- if (argc > 2)
+ if (argc > 2) {
return set_label(argv[1], argv[2]);
- else
- return get_label(argv[1]);
+ } else {
+ char label[BTRFS_LABEL_SIZE];
+ int ret;
+
+ ret = get_label(argv[1], label);
+ if (!ret)
+ fprintf(stdout, "%s\n", label);
+
+ return ret;
+ }
}
const struct cmd_group filesystem_cmd_group = {