Advised by Hitoshi: If we execute a command like this: dog node md plug "", sheep dies because sheep daemon assumes a path name passed by dog process is correct.
Response by Ruoyu: I think the above checking should be processed in framework, too. Otherwise, we must check it in every function that needs arguments. Signed-off-by: Ruoyu <lian...@ucweb.com> --- dog/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dog/common.c b/dog/common.c index 340bbed..2335e14 100644 --- a/dog/common.c +++ b/dog/common.c @@ -257,7 +257,8 @@ int do_generic_subcommand(struct subcommand *sub, int argc, char **argv) } optind++; - if (flags & CMD_NEED_ARG && argc == optind) + if ((flags & CMD_NEED_ARG) && + (argc == optind || argv[optind][0] == '\0')) subcommand_usage(argv[1], argv[2], EXIT_USAGE); ret = sub[i].fn(argc, argv); if (ret == EXIT_USAGE) -- 1.8.3.2 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog