summaryrefslogtreecommitdiff
path: root/libnm-util
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-03-17 11:39:08 +0100
committerThomas Haller <thaller@redhat.com>2016-03-26 12:10:53 +0100
commitce6fdc3e5e66a17b4fdc4519500aaa06272bce5c (patch)
tree8c19fc1cad6a569aa59b39ddead5b34aa32e0787 /libnm-util
parentbbc941245dac37083f0b46e115191c59bfbf95eb (diff)
downloadNetworkManager-ce6fdc3e5e66a17b4fdc4519500aaa06272bce5c.tar.gz
libnm-util: verify connection also for self-assignment in replace_settings_from_connection()
nm_connection_replace_settings_from_connection() would return whether the connection verifies at the end of the operation. While that is not very useful, the API is like that and cannot be changed. For consistency, also perform the verification step in case of self-assignment. Self-assigment is anyway a case that probably never happens.
Diffstat (limited to 'libnm-util')
-rw-r--r--libnm-util/nm-connection.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index c440fb1b28..daeee46b7e 100644
--- a/libnm-util/nm-connection.c
+++ b/libnm-util/nm-connection.c
@@ -409,7 +409,8 @@ nm_connection_replace_settings_from_connection (NMConnection *connection,
NMConnectionPrivate *priv;
GHashTableIter iter;
NMSetting *setting;
- gboolean changed, valid;
+ gboolean changed = FALSE;
+ gboolean valid;
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (new_connection), FALSE);
@@ -418,7 +419,7 @@ nm_connection_replace_settings_from_connection (NMConnection *connection,
/* When 'connection' and 'new_connection' are the same object simply return
* in order not to destroy 'connection' */
if (connection == new_connection)
- return TRUE;
+ goto out;
/* No need to validate permissions like nm_connection_replace_settings()
* since we're dealing with an NMConnection which has already done that.
@@ -435,6 +436,7 @@ nm_connection_replace_settings_from_connection (NMConnection *connection,
changed = TRUE;
}
+out:
valid = nm_connection_verify (connection, error);
if (changed)
g_signal_emit (connection, signals[CHANGED], 0);