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:
Lubomir Rintel
2016-07-06 13:03:21 +02:00
parent 570e8ee296
commit 33cd5149f8

View File

@@ -1445,7 +1445,7 @@ nmc_do_cmd (NmCli *nmc, const NMCCommand cmds[], const char *cmd, int argc, char
}
} else if (c->func) {
/* 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 {
/* No command and no default handler. */
g_string_printf (nmc->return_text, _("Error: missing argument. Try passing --help."));