cli: fix error reporting for connection delete

get_connection() shifts to the next argument, so we need to cache the
old one.

Fixes: 717db4fe01
This commit is contained in:
Beniamino Galvani
2016-08-02 17:11:50 +02:00
parent ec6a118f29
commit 482e506674

View File

@@ -8145,7 +8145,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
NMConnection *connection; NMConnection *connection;
ConnectionCbInfo *info = NULL; ConnectionCbInfo *info = NULL;
GSList *queue = NULL, *iter; GSList *queue = NULL, *iter;
char **arg_arr = NULL; char **arg_arr = NULL, *old_arg;
char **arg_ptr = argv; char **arg_ptr = argv;
int arg_num = argc; int arg_num = argc;
GString *invalid_cons = NULL; GString *invalid_cons = NULL;
@@ -8175,6 +8175,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
} }
while (arg_num > 0) { while (arg_num > 0) {
old_arg = *arg_ptr;
connection = get_connection (nmc, &arg_num, &arg_ptr, &pos, &error); connection = get_connection (nmc, &arg_num, &arg_ptr, &pos, &error);
if (connection) { if (connection) {
/* Check if the connection is unique. */ /* Check if the connection is unique. */
@@ -8194,7 +8195,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
if (!invalid_cons) if (!invalid_cons)
invalid_cons = g_string_new (NULL); invalid_cons = g_string_new (NULL);
g_string_append_printf (invalid_cons, "'%s', ", *arg_ptr); g_string_append_printf (invalid_cons, "'%s', ", old_arg);
} }
} }