mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 21:40:27 +01:00
libnm/team: preserve unset priv->runner_tx_hash in _align_team_properties()
There is a difference between an unset JSON array element and an empty one. Don't loose that information.
This commit is contained in:
parent
5478853a0b
commit
2a93ce9122
3 changed files with 6 additions and 7 deletions
|
|
@ -1397,7 +1397,7 @@ _align_team_properties (NMSettingTeam *setting)
|
|||
NM_CAST_STRV_CC (strv),
|
||||
-1) != 0) {
|
||||
nm_clear_pointer (&priv->runner_tx_hash, g_ptr_array_unref);
|
||||
if (strv && strv[0]) {
|
||||
if (strv) {
|
||||
priv->runner_tx_hash = g_ptr_array_new_full (NM_PTRARRAY_LEN (strv), g_free);
|
||||
for (i = 0; strv[i]; i++)
|
||||
g_ptr_array_add (priv->runner_tx_hash, strv[i]);
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ _nm_utils_json_extract_strv (char *conf,
|
|||
if ( !t_value
|
||||
|| !G_TYPE_CHECK_VALUE_TYPE (t_value, G_TYPE_STRV))
|
||||
return NULL;
|
||||
return g_strdupv (g_value_get_boxed (t_value));
|
||||
return g_strdupv (g_value_get_boxed (t_value))
|
||||
?: g_new0 (char *, 1);
|
||||
}
|
||||
|
||||
static inline GPtrArray *
|
||||
|
|
|
|||
|
|
@ -5898,11 +5898,9 @@ _nm_utils_team_config_get (const char *conf,
|
|||
if (json_is_string (str_element))
|
||||
g_ptr_array_add (data, g_strdup (json_string_value (str_element)));
|
||||
}
|
||||
if (data->len) {
|
||||
g_value_init (value, G_TYPE_STRV);
|
||||
g_value_take_boxed (value, _nm_utils_ptrarray_to_strv (data));
|
||||
}
|
||||
g_ptr_array_free (data, TRUE);
|
||||
g_ptr_array_add (data, NULL);
|
||||
g_value_init (value, G_TYPE_STRV);
|
||||
g_value_take_boxed (value, g_ptr_array_free (data, FALSE));
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
g_free (value);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue