diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-17 16:44:58 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-18 17:53:09 +0200 |
commit | 6bef72364df3dc56160eb309b280ebd40ac2cc26 (patch) | |
tree | 03b93d122e6ff020349f3bcdd855e362332a9951 | |
parent | c76aaa94edbfab467a3b897b071bdd44120c08b6 (diff) | |
download | NetworkManager-6bef72364df3dc56160eb309b280ebd40ac2cc26.tar.gz |
cli: fix handling empty match.interface-name property
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 12 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 334b531f1b..964925f644 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -3455,16 +3455,22 @@ _get_fcn_match_interface_name (ARGS_GET_FCN) num = nm_setting_match_get_num_interface_names (s_match); for (i = 0; i < num; i++) { - const char *name; 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 (""); else g_string_append_c (str, ' '); - name = nm_setting_match_get_interface_name (s_match, i); 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)); } diff --git a/clients/common/nm-meta-setting-desc.h b/clients/common/nm-meta-setting-desc.h index 44a6827b7e..fbc3867a5c 100644 --- a/clients/common/nm-meta-setting-desc.h +++ b/clients/common/nm-meta-setting-desc.h @@ -438,7 +438,7 @@ struct _NMMetaType { NMMetaAccessorGetType get_type, NMMetaAccessorGetFlags get_flags, NMMetaAccessorGetOutFlags *out_flags, - gboolean *out_is_defalt, + gboolean *out_is_default, gpointer *out_to_free); const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info, const NMMetaEnvironment *environment, |