summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-02-21 10:14:50 +0100
committerLubomir Rintel <lkundrak@v3.sk>2017-02-27 11:16:45 +0100
commit54086127ef6dcabcf387101305668103bd5c3b1d (patch)
tree0337793ad955e6e47310b94c0820eb5e726feab0
parent61722fdeb10c146e518840cda73914be151ba571 (diff)
downloadNetworkManager-54086127ef6dcabcf387101305668103bd5c3b1d.tar.gz
ifcfg-rh: don't shortcut writing if the connection stays the same
Some keys, such as MASTER may still be different as they may depend on other connections. svWriteFile() checks if the resulting file is different already anyway.
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c
index 33f4847ed1..3833f3574e 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c
@@ -336,35 +336,12 @@ commit_changes (NMSettingsConnection *connection,
gpointer user_data)
{
GError *error = NULL;
- NMConnection *reread;
- gboolean same = FALSE, success = FALSE;
+ gboolean success = FALSE;
char *ifcfg_path = NULL;
const char *filename;
- /* To ensure we don't rewrite files that are only changed from other
- * processes on-disk, read the existing connection back in and only rewrite
- * it if it's really changed.
- */
filename = nm_settings_connection_get_filename (connection);
if (filename) {
- gs_free char *unhandled = NULL;
-
- reread = connection_from_file (filename, &unhandled, NULL, NULL);
- if (reread) {
- same = nm_connection_compare (NM_CONNECTION (connection),
- reread,
- NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS |
- NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS);
- g_object_unref (reread);
-
- /* Don't bother writing anything out if in-memory and on-disk data are the same */
- if (same) {
- /* But chain up to parent to handle success - emits updated signal */
- NM_SETTINGS_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->commit_changes (connection, commit_reason, callback, user_data);
- return;
- }
- }
-
success = writer_update_connection (NM_CONNECTION (connection),
IFCFG_DIR,
filename,