From: Anand Jain Date: Tue, 14 Jan 2014 11:17:07 +0000 (+0800) Subject: btrfs-progs: return non zero when label is not found X-Git-Tag: upstream/4.16.1~2969 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31f30c99757057880c89f36b3e47eb1ec0af19d1;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: return non zero when label is not found btrfs filesystem show should return non zero Signed-off-by: Anand Jain Signed-off-by: David Sterba Signed-off-by: Chris Mason --- diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 7e11507c..43e1cf3c 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -539,6 +539,7 @@ static int cmd_show(int argc, char **argv) char path[PATH_MAX]; __u8 fsid[BTRFS_FSID_SIZE]; char uuid_buf[37]; + int found = 0; while (1) { int long_index; @@ -613,8 +614,10 @@ static int cmd_show(int argc, char **argv) /* show mounted btrfs */ ret = btrfs_scan_kernel(search); - if (search && !ret) - return 0; + if (search && !ret) { + /* since search is found we are done */ + goto out; + } /* shows mounted only */ if (where == BTRFS_SCAN_MOUNTED) @@ -636,12 +639,15 @@ devs_only: continue; print_one_uuid(fs_devices); + found = 1; } + if (search && !found) + ret = 1; out: printf("%s\n", BTRFS_BUILD_VERSION); free_seen_fsid(); - return 0; + return ret; } static const char * const cmd_sync_usage[] = {