diff mbox

btrfs-progs: fi show: print error message if no valid Btrfs is specified

Message ID a22eda17-c639-9b2b-fa08-d4f0b032d4c9@jp.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Satoru Takeuchi June 24, 2016, 8:24 a.m. UTC
* 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>
---
 cmds-filesystem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

David Sterba June 24, 2016, 12:01 p.m. UTC | #1
On Fri, Jun 24, 2016 at 05:24:47PM +0900, Satoru Takeuchi wrote:
> * 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>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 88867a3..90f3c49 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -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("%s is not a valid Btrfs", search);
 		ret = 1;
-
+	}
 	while (!list_empty(&all_uuids)) {
 		fs_devices = list_entry(all_uuids.next,
 					struct btrfs_fs_devices, list);