summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-connection.c18
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-plugin.c5
2 files changed, 19 insertions, 4 deletions
diff --git a/src/settings/plugins/keyfile/nms-keyfile-connection.c b/src/settings/plugins/keyfile/nms-keyfile-connection.c
index ca98b5677a..bd07d263c1 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-connection.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-connection.c
@@ -58,14 +58,16 @@ commit_changes (NMSettingsConnection *connection,
{
char *path = NULL;
GError *error = NULL;
+ gs_unref_object NMConnection *reread = NULL;
+ gboolean reread_same = FALSE;
if (!nms_keyfile_writer_connection (NM_CONNECTION (connection),
nm_settings_connection_get_filename (connection),
NM_FLAGS_ALL (commit_reason, NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION
| NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED),
&path,
- NULL,
- NULL,
+ &reread,
+ &reread_same,
&error)) {
callback (connection, error, user_data);
g_clear_error (&error);
@@ -91,6 +93,18 @@ commit_changes (NMSettingsConnection *connection,
NMS_KEYFILE_CONNECTION_LOG_ARG (connection));
}
+ if (reread && !reread_same) {
+ gs_free_error GError *local = NULL;
+
+ if (!nm_settings_connection_replace_settings (connection, reread, FALSE, "update-during-write", &local)) {
+ nm_log_warn (LOGD_SETTINGS, "keyfile: update "NMS_KEYFILE_CONNECTION_LOG_FMT" after persisting connection failed: %s",
+ NMS_KEYFILE_CONNECTION_LOG_ARG (connection), local->message);
+ } else {
+ nm_log_info (LOGD_SETTINGS, "keyfile: update "NMS_KEYFILE_CONNECTION_LOG_FMT" after persisting connection",
+ NMS_KEYFILE_CONNECTION_LOG_ARG (connection));
+ }
+ }
+
g_free (path);
NM_SETTINGS_CONNECTION_CLASS (nms_keyfile_connection_parent_class)->commit_changes (connection,
diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
index 0b084d6e55..d76b64c726 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c
@@ -530,18 +530,19 @@ add_connection (NMSettingsPlugin *config,
{
NMSKeyfilePlugin *self = NMS_KEYFILE_PLUGIN (config);
gs_free char *path = NULL;
+ gs_unref_object NMConnection *reread = NULL;
if (save_to_disk) {
if (!nms_keyfile_writer_connection (connection,
NULL,
FALSE,
&path,
- NULL,
+ &reread,
NULL,
error))
return NULL;
}
- return NM_SETTINGS_CONNECTION (update_connection (self, connection, path, NULL, FALSE, NULL, error));
+ return NM_SETTINGS_CONNECTION (update_connection (self, reread ?: connection, path, NULL, FALSE, NULL, error));
}
static GSList *