settings/keyfile: always return path from nms_keyfile_writer_connection()

Previously, nms_keyfile_writer_connection() would only return @out_path, if
it differed from @existing_path. That might make sense, if we could thereby
avoid duplicating @existing_path, however, we never did that
optimization.

Just consistently always return the path, let the caller deal with this.
This commit is contained in:
Thomas Haller 2018-08-24 12:53:02 +02:00
parent 986ca94a36
commit 80cb515681
2 changed files with 3 additions and 8 deletions

View file

@ -75,9 +75,7 @@ commit_changes (NMSettingsConnection *connection,
error))
return FALSE;
/* Update the filename if it changed */
if ( path
&& g_strcmp0 (path, nm_settings_connection_get_filename (connection)) != 0) {
if (!nm_streq0 (path, nm_settings_connection_get_filename (connection))) {
gs_free char *old_path = g_strdup (nm_settings_connection_get_filename (connection));
nm_settings_connection_set_filename (connection, path);

View file

@ -299,11 +299,6 @@ _internal_write_connection (NMConnection *connection,
return FALSE;
}
if (out_path && g_strcmp0 (existing_path, path)) {
*out_path = path; /* pass path out to caller */
path = NULL;
}
if (out_reread || out_reread_same)
{
gs_unref_object NMConnection *reread = NULL;
@ -335,6 +330,8 @@ _internal_write_connection (NMConnection *connection,
NM_SET_OUT (out_reread_same, reread_same);
}
NM_SET_OUT (out_path, g_steal_pointer (&path));
return TRUE;
}