btrfs-progs: fi show: print error message if no valid Btrfs is specified
authorSatoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Fri, 24 Jun 2016 08:24:47 +0000 (17:24 +0900)
committerDavid Sterba <dsterba@suse.com>
Fri, 24 Jun 2016 12:05:43 +0000 (14:05 +0200)
* Before this patch

 ===============================
 # ./btrfs fi show foo      # "foo" doesn't mean any valid Btrfs
 #                          # no error message
 # echo $?
 1
 ===============================

* After this patch

 ===============================
 # ./btrfs fi show foo
 ERROR: foo is not a valid Btrfs
 #
 # echo $?
 1
 ===============================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-filesystem.c

index 88867a3d03148fa9d91be17c43cf04306ade274d..9392a30bd045f99467a81b72b5b23c53a0bd4d29 100644 (file)
@@ -898,9 +898,10 @@ devs_only:
        list_for_each_entry(fs_devices, &all_uuids, list)
                print_one_uuid(fs_devices, unit_mode);
 
-       if (search && !found)
+       if (search && !found) {
+               error("not a valid btrfs filesystem: %s", search);
                ret = 1;
-
+       }
        while (!list_empty(&all_uuids)) {
                fs_devices = list_entry(all_uuids.next,
                                        struct btrfs_fs_devices, list);