When a subcommand given by argv[3], always output help messages incorrectly.
For example: dog vdi object location|map|dump-inode, always output location's
help messages instead of map's or dump-inode's. So fix it.

Signed-off-by: Meng Lingkun <[email protected]>
---
 dog/common.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/dog/common.c b/dog/common.c
index 6ff1e19..0f73b2c 100644
--- a/dog/common.c
+++ b/dog/common.c
@@ -255,14 +255,13 @@ int do_generic_subcommand(struct subcommand *sub, int 
argc, char **argv)
                exit(EXIT_USAGE);
        }
 
-       subcmd_stack[++subcmd_depth] = sub;
-
        for (i = 0; sub[i].name; i++) {
                unsigned long flags;
 
                if (strcmp(sub[i].name, argv[optind]))
                        continue;
 
+               subcmd_stack[++subcmd_depth] = &sub[i];
                flags = sub[i].flags;
 
                if (flags & CMD_NEED_NODELIST) {
-- 
1.7.1



-- 
sheepdog mailing list
[email protected]
https://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to