diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-02-24 13:34:14 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-02-25 14:41:52 +0100 |
commit | 8b35b9e06118fd87bb32e79ad10952cf2b236a24 (patch) | |
tree | 59e98081dbf141958421747577b1a793325a90c7 | |
parent | 7c0b43ded6a1b9e4c059adb63c33290697e3d363 (diff) | |
download | NetworkManager-8b35b9e06118fd87bb32e79ad10952cf2b236a24.tar.gz |
cli: silently ignore duplicated categories in "--order" option (bgo #738613)
It was considered as a hard error before, but we can actually only ignore it.
Related commit: 40e98f5d685bc41da32f65e6ee3b5ad1b46cca3f
-rw-r--r-- | clients/cli/connections.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 1ef843a56b..5c426398fd 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -9068,7 +9068,7 @@ parse_preferred_connection_order (const char *order, GError **error) const char *str; GArray *order_arr; NmcSortOrder val; - gboolean inverse; + gboolean inverse, unique; int i; strv = nmc_strsplit_set (order, ":", -1); @@ -9103,21 +9103,20 @@ parse_preferred_connection_order (const char *order, GError **error) _("incorrect item '%s' in '--order' option"), *iter); break; } - /* Check duplicates*/ + /* Check for duplicates and ignore them. */ + unique = TRUE; for (i = 0; i < order_arr->len; i++) { if (abs (g_array_index (order_arr, NmcSortOrder, i)) - abs (val) == 0) { - g_array_unref (order_arr); - order_arr = NULL; - g_set_error (error, NMCLI_ERROR, 0, - _("'%s' repeats in '--order' option"), str); - goto end; + unique = FALSE; + break; } } /* Value is ok and unique, add it to the array */ - g_array_append_val (order_arr, val); + if (unique) + g_array_append_val (order_arr, val); } -end: + g_strfreev (strv); return order_arr; } |