btrfs-progs: return non zero when label is not found
btrfs filesystem show <not-found-label> should return non zero Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
94abeb46b7
commit
31f30c9975
|
@ -539,6 +539,7 @@ static int cmd_show(int argc, char **argv)
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
__u8 fsid[BTRFS_FSID_SIZE];
|
__u8 fsid[BTRFS_FSID_SIZE];
|
||||||
char uuid_buf[37];
|
char uuid_buf[37];
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int long_index;
|
int long_index;
|
||||||
|
@ -613,8 +614,10 @@ static int cmd_show(int argc, char **argv)
|
||||||
|
|
||||||
/* show mounted btrfs */
|
/* show mounted btrfs */
|
||||||
ret = btrfs_scan_kernel(search);
|
ret = btrfs_scan_kernel(search);
|
||||||
if (search && !ret)
|
if (search && !ret) {
|
||||||
return 0;
|
/* since search is found we are done */
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* shows mounted only */
|
/* shows mounted only */
|
||||||
if (where == BTRFS_SCAN_MOUNTED)
|
if (where == BTRFS_SCAN_MOUNTED)
|
||||||
|
@ -636,12 +639,15 @@ devs_only:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
print_one_uuid(fs_devices);
|
print_one_uuid(fs_devices);
|
||||||
|
found = 1;
|
||||||
}
|
}
|
||||||
|
if (search && !found)
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
printf("%s\n", BTRFS_BUILD_VERSION);
|
printf("%s\n", BTRFS_BUILD_VERSION);
|
||||||
free_seen_fsid();
|
free_seen_fsid();
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const cmd_sync_usage[] = {
|
static const char * const cmd_sync_usage[] = {
|
||||||
|
|
Loading…
Reference in a new issue