linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: fix btrfstune silence on failure
@ 2013-12-13  9:59 Gui Hecheng
  2013-12-17 14:35 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Gui Hecheng @ 2013-12-13  9:59 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gui Hecheng

Originally, btrfstune will fail without any options and just exit
with no failure prompt.
Now, the number of arguments are checked before parse options
and error msg will show up upon failure.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
 btrfstune.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/btrfstune.c b/btrfstune.c
index 50724ba..ecaf13d 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -115,6 +115,11 @@ int main(int argc, char *argv[])
 	int skinny_flag = 0;
 	int ret;
 
+	if (argc < 3) {
+		print_usage();
+		return 1;
+	}
+
 	while(1) {
 		int c = getopt(argc, argv, "S:rx");
 		if (c < 0)
@@ -176,6 +181,7 @@ int main(int argc, char *argv[])
 	} else {
 		root->fs_info->readonly = 1;
 		ret = 1;
+		fprintf(stderr, "btrfstune failed\n");
 	}
 	close_ctree(root);
 
-- 
1.8.0.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-17 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13  9:59 [PATCH] btrfs-progs: fix btrfstune silence on failure Gui Hecheng
2013-12-17 14:35 ` David Sterba
2013-12-17 15:03   ` Wang Shilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).