mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 18:24:49 +00:00
libnm-util: make nm_connection_replace_settings_from_connection() safer
When 'connection' and 'new_connection' arguments are the same object make the function no-op and simply return true. Otherwise 'connection's settings are removed, making it invalid. Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
This commit is contained in:
parent
f5507633f8
commit
841c259119
|
@ -506,6 +506,11 @@ nm_connection_replace_settings_from_connection (NMConnection *connection,
|
|||
if (error)
|
||||
g_return_val_if_fail (*error == NULL, FALSE);
|
||||
|
||||
/* When 'connection' and 'new_connection' are the same object simply return
|
||||
* in order not to destroy 'connection' */
|
||||
if (connection == new_connection)
|
||||
return TRUE;
|
||||
|
||||
/* No need to validate permissions like nm_connection_replace_settings()
|
||||
* since we're dealing with an NMConnection which has already done that.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue