[sheepdog] [PATCH] collie: fix optional third para parsing

Liu Yuan namei.unix at gmail.com
Tue Nov 20 12:03:20 CET 2012


From: Liu Yuan <tailai.ly at taobao.com>

For command like 'collie vdi list [vdiname]', the third para [vdiname] is
optinal, so we should not strickly check third argument existence even if
SUBCMD_FLAG_NEED_THIRD_ARG is not set. Otherwise, 'collie vdi list test' will
not be functional.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 collie/collie.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/collie/collie.c b/collie/collie.c
index 060e53c..b5952df 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -413,8 +413,5 @@ int main(int argc, char **argv)
 	if (flags & SUBCMD_FLAG_NEED_THIRD_ARG && argc == optind)
 		subcommand_usage(argv[1], argv[2], EXIT_USAGE);
 
-	if (!(flags & SUBCMD_FLAG_NEED_THIRD_ARG) && argc != optind)
-		subcommand_usage(argv[1], argv[2], EXIT_USAGE);
-
 	return command_fn(argc, argv);
 }
-- 
1.7.9.5




More information about the sheepdog mailing list