ifcfg-rh: use nm_utils_escaped_tokens* for "MATCH_INTERFACE_NAME"
For one, use NM_ASCII_SPACES as delimiter when reading
"MATCH_INTERFACE_NAME". Previously, it was only " \t".
I think there is no change in behavior otherwise.
(cherry picked from commit 941f27d350
)
This commit is contained in:
@@ -1427,13 +1427,12 @@ make_match_setting (shvarFile *ifcfg)
|
|||||||
if (!v)
|
if (!v)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
strv = nm_utils_strsplit_set_full (v, " \t", NM_UTILS_STRSPLIT_SET_FLAGS_ALLOW_ESCAPING);
|
strv = nm_utils_escaped_tokens_split (v, NM_ASCII_SPACES);
|
||||||
if (strv) {
|
if (strv) {
|
||||||
for (i = 0; strv[i]; i++) {
|
for (i = 0; strv[i]; i++) {
|
||||||
if (!s_match)
|
if (!s_match)
|
||||||
s_match = (NMSettingMatch *) nm_setting_match_new ();
|
s_match = (NMSettingMatch *) nm_setting_match_new ();
|
||||||
nm_setting_match_add_interface_name (s_match,
|
nm_setting_match_add_interface_name (s_match, strv[i]);
|
||||||
_nm_utils_unescape_spaces ((char *) strv[i], TRUE));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2375,15 +2375,17 @@ write_match_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||||||
|
|
||||||
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++) {
|
||||||
gs_free char *to_free = NULL;
|
|
||||||
const char *name;
|
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);
|
nm_utils_escaped_tokens_escape_gstr (name, NM_ASCII_SPACES, str);
|
||||||
g_string_append (str, _nm_utils_escape_spaces (name, &to_free));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str)
|
if (str)
|
||||||
|
Reference in New Issue
Block a user