From 312c7c952cbb3f20bcb1092db9bfbb51485fcebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 2 Aug 2011 09:15:37 +0200 Subject: [PATCH] ifcfg-rh: emit "updated" signal when connection file is changed (rh #727501) Chain up to parent's commit_changes() even if in-memory and on-disk data are the same; they are the same when another process changes the on-disk file. Just make sure not to write out the data needlessly when same. This fixes a regression caused by 9cba854fa0a32022a44e922dd4e70aaaf3c00dd2. It exhibits e.g. by not auto-activating connection when ONBOOT is changed from "no" to "yes". Connection "updated" signal was not emitted and listeners like NMPolicy was not prodded. --- src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c index 534f44d9ff..04d3d3e453 100644 --- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c +++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2008 - 2010 Red Hat, Inc. + * Copyright (C) 2008 - 2011 Red Hat, Inc. */ #include @@ -181,7 +181,7 @@ nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self) static void commit_changes (NMSettingsConnection *connection, NMSettingsConnectionCommitFunc callback, - gpointer user_data) + gpointer user_data) { NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection); GError *error = NULL; @@ -208,9 +208,12 @@ commit_changes (NMSettingsConnection *connection, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS); g_object_unref (reread); - /* Don't bother writing anything out if nothing really changed */ - if (same == TRUE) + /* 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, callback, user_data); return; + } } if (writer_update_connection (NM_CONNECTION (connection), @@ -227,7 +230,7 @@ commit_changes (NMSettingsConnection *connection, } } -static void +static void do_delete (NMSettingsConnection *connection, NMSettingsConnectionDeleteFunc callback, gpointer user_data)