[sheepdog] [PATCH] collie: exit with an error when there are too many arguments

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Oct 11 21:35:30 CEST 2012


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/collie.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/collie/collie.c b/collie/collie.c
index 8897468..18c3cf2 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -414,5 +414,8 @@ 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.2.5




More information about the sheepdog mailing list