From ec6a118f292eb6262773780134d4e6e19e074e50 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 2 Aug 2016 16:49:37 +0200 Subject: [PATCH] cli: fix connection delete/monitor The two commands should apply to all available connections matching the given name. Fixes: 717db4fe014ecc80eb8bb86757f724448116a662 --- clients/cli/connections.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index ed8f67b6d0..e5dcab919d 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -1698,7 +1698,11 @@ get_connection (NmCli *nmc, int *argc, char ***argv, int *pos, GError **error) _("unknown connection '%s'"), **argv); } - next_arg (argc, argv); + /* If the caller wants multiple results (pos is set) and there are any, + * don't switch to next argument. + */ + if (!pos || !*pos) + next_arg (argc, argv); return connection; } @@ -8192,10 +8196,6 @@ do_connection_delete (NmCli *nmc, int argc, char **argv) invalid_cons = g_string_new (NULL); g_string_append_printf (invalid_cons, "'%s', ", *arg_ptr); } - - /* Take next argument (if there's no other connection of the same name) */ - if (!pos) - next_arg (&arg_num, &arg_ptr); } if (!queue) { @@ -8310,9 +8310,6 @@ do_connection_monitor (NmCli *nmc, int argc, char **argv) g_string_printf (nmc->return_text, _("Error: not all connections found.")); return error->code; } - /* Take next argument (if there's no other connection of the same name) */ - if (!pos) - next_arg (&argc, &argv); if (nmc->complete) continue;