cli: do not skip over a nonexistent argument in nmc_do_cmd()
If we're called without an argument, don't shift arguments of the callback -- it would be called with argc==-1.
This commit is contained in:
@@ -1445,7 +1445,7 @@ nmc_do_cmd (NmCli *nmc, const NMCCommand cmds[], const char *cmd, int argc, char
|
|||||||
}
|
}
|
||||||
} else if (c->func) {
|
} else if (c->func) {
|
||||||
/* No command, run the default handler. */
|
/* No command, run the default handler. */
|
||||||
nmc->return_value = c->func (nmc, argc-1, argv+1);
|
nmc->return_value = c->func (nmc, argc, argv);
|
||||||
} else {
|
} else {
|
||||||
/* No command and no default handler. */
|
/* No command and no default handler. */
|
||||||
g_string_printf (nmc->return_text, _("Error: missing argument. Try passing --help."));
|
g_string_printf (nmc->return_text, _("Error: missing argument. Try passing --help."));
|
||||||
|
Reference in New Issue
Block a user