mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-21 04:00:09 +01:00
libnm-util: handle "empty" connection-type settings correctly
nm_setting_to_hash() would return NULL if the setting had entirely default values, but this effectively meant that you could never have a connection whose "connection type" setting (eg, NMSettingWired) had all default values. (This ended up not usually being a problem in practice because most such settings had at least one property with a mandatory string value where the GObject property had a default value of NULL.) However, NMSettingGeneric will have no properties, so it would always get stripped out when converting to a hash, invalidating the connection. Fix that.
This commit is contained in:
parent
6cb786f569
commit
4d32618264
1 changed files with 2 additions and 2 deletions
|
|
@ -304,8 +304,8 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags)
|
||||||
}
|
}
|
||||||
g_free (property_specs);
|
g_free (property_specs);
|
||||||
|
|
||||||
/* Don't return empty hashes */
|
/* Don't return empty hashes, except for base types */
|
||||||
if (g_hash_table_size (hash) < 1) {
|
if (g_hash_table_size (hash) < 1 && !_nm_setting_is_base_type (setting)) {
|
||||||
g_hash_table_destroy (hash);
|
g_hash_table_destroy (hash);
|
||||||
hash = NULL;
|
hash = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue