[PATCH] btrfs-progs: fix btrfstune silence on failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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

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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux