diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-05-24 17:57:55 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-05-24 18:39:11 +0200 |
commit | 3fd9bf9d7d9fc0290fd25f709b60a3a8f5c7e334 (patch) | |
tree | 4f18fbc7902f7b6d89ef9e805555bc17f64ab8e4 | |
parent | bb87c67f10160d10e02f30cbafb4ee47b87073f7 (diff) | |
download | NetworkManager-3fd9bf9d7d9fc0290fd25f709b60a3a8f5c7e334.tar.gz |
clients: fix an error message in case of property ambiguity
Before:
$ nmcli c modify Dukkha ipv4.ignore no
Error: invalid property 'ignore': 'ignore' is ambiguous (ignore-auto-routes x (null)).
After:
$ nmcli c modify Dukkha ipv4.ignore no
Error: invalid property 'ignore': 'ignore' is ambiguous (ignore-auto-routes x ignore-auto-dns).
-rw-r--r-- | clients/common/nm-client-utils.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clients/common/nm-client-utils.c b/clients/common/nm-client-utils.c index f683c7ce81..257053093e 100644 --- a/clients/common/nm-client-utils.c +++ b/clients/common/nm-client-utils.c @@ -175,7 +175,8 @@ nmc_string_is_valid (const char *input, const char **allowed, GError **error) { const char **p; size_t input_ln, p_len; - gboolean prev_match = FALSE, ambiguous = FALSE; + gboolean ambiguous = FALSE; + const char *prev_match = NULL; const char *ret = NULL; g_return_val_if_fail (error == NULL || *error == NULL, NULL); @@ -193,15 +194,16 @@ nmc_string_is_valid (const char *input, const char **allowed, GError **error) break; } if (!prev_match) { + prev_match = *p; + } else { ret = *p; - prev_match = TRUE; - } else ambiguous = TRUE; + } } } if (ambiguous) { g_set_error (error, 1, 1, _("'%s' is ambiguous (%s x %s)"), - input, ret, *p); + input, prev_match, ret); return NULL; } finish: |