libnm-util: add comment for return value of nm_connection_replace_settings_from_conne...
authorThomas Haller <thaller@redhat.com>
Tue, 15 Mar 2016 17:44:31 +0000 (18:44 +0100)
committerThomas Haller <thaller@redhat.com>
Tue, 15 Mar 2016 17:51:49 +0000 (18:51 +0100)
nm_connection_replace_settings_from_connection() can safely be used
to copy an invalid connection. The return value only says, whether
the connection is valid after the fact.

libnm-util/nm-connection.c

index ea791c5..98de9b8 100644 (file)
@@ -394,8 +394,10 @@ nm_connection_replace_settings (NMConnection *connection,
  * Deep-copies the settings of @new_conenction and replaces the settings of @connection
  * with the copied settings.
  *
- * Returns: %TRUE if the settings were valid and added to the connection, %FALSE
- * if they were not
+ * Returns: %TRUE if the settings were valid after replacing the connection, %FALSE
+ * if they were not. Regardless of whether %TRUE or %FALSE is returned, the connection
+ * is successfully replaced. %FALSE only means, that after the operation that the
+ * connection does not verifiy.
  *
  * Since: 0.9.10
  **/
@@ -411,8 +413,7 @@ nm_connection_replace_settings_from_connection (NMConnection *connection,
 
        g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
        g_return_val_if_fail (NM_IS_CONNECTION (new_connection), FALSE);
-       if (error)
-               g_return_val_if_fail (*error == NULL, FALSE);
+       g_return_val_if_fail (!error || !*error, FALSE);
 
        /* When 'connection' and 'new_connection' are the same object simply return
         * in order not to destroy 'connection' */