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).
This commit is contained in:
@@ -175,7 +175,8 @@ nmc_string_is_valid (const char *input, const char **allowed, GError **error)
|
|||||||
{
|
{
|
||||||
const char **p;
|
const char **p;
|
||||||
size_t input_ln, p_len;
|
size_t input_ln, p_len;
|
||||||
gboolean prev_match = FALSE, ambiguous = FALSE;
|
gboolean ambiguous = FALSE;
|
||||||
|
const char *prev_match = NULL;
|
||||||
const char *ret = NULL;
|
const char *ret = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, 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;
|
break;
|
||||||
}
|
}
|
||||||
if (!prev_match) {
|
if (!prev_match) {
|
||||||
|
prev_match = *p;
|
||||||
|
} else {
|
||||||
ret = *p;
|
ret = *p;
|
||||||
prev_match = TRUE;
|
|
||||||
} else
|
|
||||||
ambiguous = TRUE;
|
ambiguous = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ambiguous) {
|
if (ambiguous) {
|
||||||
g_set_error (error, 1, 1, _("'%s' is ambiguous (%s x %s)"),
|
g_set_error (error, 1, 1, _("'%s' is ambiguous (%s x %s)"),
|
||||||
input, ret, *p);
|
input, prev_match, ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
finish:
|
finish:
|
||||||
|
Reference in New Issue
Block a user