summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-05-27 17:07:48 +0200
committerThomas Haller <thaller@redhat.com>2020-06-03 18:25:32 +0200
commitc3db3e0044c2a05be8cf311424ddc9c52062cd1e (patch)
treee9bbfc1243b933aefcce01dd2ff77bc85c33363b
parent6f3ae8a56306d2c6ab3dae45f53d5565660844f2 (diff)
downloadNetworkManager-c3db3e0044c2a05be8cf311424ddc9c52062cd1e.tar.gz
core: don't do anything if there are no changes in nm_settings_connection_update_timestamp()
Updating the timestamp marks the keyfile database as dirty. Avoid that, if there is no change. Of course, nm_key_file_db_set_value() itself already checks whether the are any changes, and does nothing if there aren't. Simply perform the check earlier, to do nothing.
-rw-r--r--src/settings/nm-settings-connection.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 48e3dce253..1c3e7fe34c 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -2136,12 +2136,18 @@ void
nm_settings_connection_update_timestamp (NMSettingsConnection *self,
guint64 timestamp)
{
- NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
+ NMSettingsConnectionPrivate *priv;
const char *connection_uuid;
char sbuf[60];
g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
+ priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
+
+ if ( priv->timestamp == timestamp
+ && priv->timestamp_set)
+ return;
+
priv->timestamp = timestamp;
priv->timestamp_set = TRUE;