mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 05:58:01 +02:00
cli: fix handling empty match.interface-name property
This commit is contained in:
parent
c76aaa94ed
commit
6bef72364d
2 changed files with 10 additions and 4 deletions
|
|
@ -3455,16 +3455,22 @@ _get_fcn_match_interface_name (ARGS_GET_FCN)
|
||||||
|
|
||||||
num = nm_setting_match_get_num_interface_names (s_match);
|
num = nm_setting_match_get_num_interface_names (s_match);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
const char *name;
|
|
||||||
gs_free char *to_free = NULL;
|
gs_free char *to_free = NULL;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
if (i == 0)
|
name = nm_setting_match_get_interface_name (s_match, i);
|
||||||
|
if (!name || !name[0])
|
||||||
|
continue;
|
||||||
|
if (!str)
|
||||||
str = g_string_new ("");
|
str = g_string_new ("");
|
||||||
else
|
else
|
||||||
g_string_append_c (str, ' ');
|
g_string_append_c (str, ' ');
|
||||||
name = nm_setting_match_get_interface_name (s_match, i);
|
|
||||||
g_string_append (str, _value_strescape (name, &to_free));
|
g_string_append (str, _value_strescape (name, &to_free));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NM_SET_OUT (out_is_default, num == 0);
|
||||||
|
if (!str)
|
||||||
|
return NULL;
|
||||||
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
|
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,7 @@ struct _NMMetaType {
|
||||||
NMMetaAccessorGetType get_type,
|
NMMetaAccessorGetType get_type,
|
||||||
NMMetaAccessorGetFlags get_flags,
|
NMMetaAccessorGetFlags get_flags,
|
||||||
NMMetaAccessorGetOutFlags *out_flags,
|
NMMetaAccessorGetOutFlags *out_flags,
|
||||||
gboolean *out_is_defalt,
|
gboolean *out_is_default,
|
||||||
gpointer *out_to_free);
|
gpointer *out_to_free);
|
||||||
const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info,
|
const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info,
|
||||||
const NMMetaEnvironment *environment,
|
const NMMetaEnvironment *environment,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue