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 <[email protected]> --- 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
