summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-08-02 16:49:37 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-08-02 16:49:37 +0200
commitec6a118f292eb6262773780134d4e6e19e074e50 (patch)
tree13bbbde786f18ee46160bc6a78b20e11def74b31
parent2adb5fc00f68f222180df155c891c93706c80bbf (diff)
downloadNetworkManager-ec6a118f292eb6262773780134d4e6e19e074e50.tar.gz
cli: fix connection delete/monitor
The two commands should apply to all available connections matching the given name. Fixes: 717db4fe014ecc80eb8bb86757f724448116a662
-rw-r--r--clients/cli/connections.c13
1 files 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;