All of lore.kernel.org
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [PATCH] btrfs-progs: fi show: print error message if no valid Btrfs is specified
Date: Fri, 24 Jun 2016 17:24:47 +0900	[thread overview]
Message-ID: <a22eda17-c639-9b2b-fa08-d4f0b032d4c9@jp.fujitsu.com> (raw)

* 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(-)

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);
-- 
2.5.5

             reply	other threads:[~2016-06-24  8:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24  8:24 Satoru Takeuchi [this message]
2016-06-24 12:01 ` [PATCH] btrfs-progs: fi show: print error message if no valid Btrfs is specified David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a22eda17-c639-9b2b-fa08-d4f0b032d4c9@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.