diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-11-25 13:41:38 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-11-25 13:46:26 +0100 |
commit | 869b6ab56d144ccb105be7186e5d66b4d0f3ed20 (patch) | |
tree | 81f8215dde7e7f1dece4bf22f6310e702584f172 | |
parent | 78068d6bae4a85a4776792360a873607f6574529 (diff) | |
download | NetworkManager-jk/bridge-slave-fix.tar.gz |
libnm-util: return empty hash rather than NULL in nm_setting_to_hash()jk/bridge-slave-fix
The function was changed to return NULL instead of empty hash by commit
ad56cfa914d6a0f49b51e917ce89001f19c72d9f. Later, the condition had to be
relaxed for NMSettingGeneric (commit 4d32618264d7ca169036347a25f38689cce632f3).
Unforfunately, it shows up that there are other use cases that require
presence of a setting (that might have all properties default), such as
NMSettingBridgePort for bridge slave connections.
-rw-r--r-- | libnm-util/nm-setting.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 4df2bced1d..2e27453dbb 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -349,11 +349,12 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags) } g_free (property_specs); - /* Don't return empty hashes, except for base types */ - if (g_hash_table_size (hash) < 1 && !_nm_setting_is_base_type (setting)) { - g_hash_table_destroy (hash); - hash = NULL; - } + /* Return the hash even if it is empty (due to default values). + * Some settings can have all properties with default values, but + * the presence of the setting may be required. (For example, + * NMSettingGeneric, NMSettingBridgePort, + * NMSettingTeamPort) + */ return hash; } |