From: Thomas Haller Date: Thu, 17 Mar 2016 10:39:08 +0000 (+0100) Subject: libnm-util: verify connection also for self-assignment in replace_settings_from_conne... X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=NetworkManager.git;a=commitdiff_plain;h=ce6fdc3e5e66a17b4fdc4519500aaa06272bce5c 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. --- diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index c440fb1b2..daeee46b7 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);