diff options
author | Dan Winship <danw@gnome.org> | 2014-08-22 10:14:38 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-09-04 09:17:37 -0400 |
commit | 504c292d7389e68e926a428cc5083359a6ba2e0b (patch) | |
tree | bf4f73c051c31612fcaf581610a8a81b5de1cbb7 /libnm | |
parent | 05f30681635157e07e7a5dd210b5c621a5a53fd9 (diff) | |
download | NetworkManager-504c292d7389e68e926a428cc5083359a6ba2e0b.tar.gz |
libnm-core: clean up nm_connection_replace_settings()'s semantics
On failure, nm_connection_replace_settings() would leave the
connection in an undefined state. Fix it so that either (a) the
settings are replaced and the resulting connection is valid and we
return TRUE, or (b) the connection is untouched and we return FALSE
and an error. (And add a test case for this.)
Diffstat (limited to 'libnm')
-rw-r--r-- | libnm/libnm.ver | 1 | ||||
-rw-r--r-- | libnm/nm-remote-connection.c | 6 |
2 files changed, 2 insertions, 5 deletions
diff --git a/libnm/libnm.ver b/libnm/libnm.ver index ed00474daf..7ad57bcc3f 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -75,6 +75,7 @@ global: nm_connection_add_setting; nm_connection_clear_secrets; nm_connection_clear_secrets_with_flags; + nm_connection_clear_settings; nm_connection_compare; nm_connection_diff; nm_connection_dump; diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c index f821180ca1..e42806edc1 100644 --- a/libnm/nm-remote-connection.c +++ b/libnm/nm-remote-connection.c @@ -457,14 +457,10 @@ updated_get_settings_cb (DBusGProxy *proxy, DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &new_settings, G_TYPE_INVALID); if (error) { - GHashTable *hash; - g_error_free (error); /* Connection is no longer visible to this user. */ - hash = g_hash_table_new (g_str_hash, g_str_equal); - nm_connection_replace_settings (NM_CONNECTION (self), hash, NULL); - g_hash_table_destroy (hash); + nm_connection_clear_settings (NM_CONNECTION (self)); visible = FALSE; } else { |