rpms/NetworkManager/F-11 ifcfg-rh-inotify-update-fix.patch, NONE, 1.1 NetworkManager.spec, 1.271, 1.272

Daniel Williams dcbw at fedoraproject.org
Thu Apr 16 14:49:56 UTC 2009


Author: dcbw

Update of /cvs/pkgs/rpms/NetworkManager/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7602

Modified Files:
	NetworkManager.spec 
Added Files:
	ifcfg-rh-inotify-update-fix.patch 
Log Message:
* Thu Apr 16 2009 Dan Williams <dcbw at redhat.com> - 1:0.7.1-3.git20090414
- ifcfg-rh: fix problems noticing changes via inotify (rh #495884)



ifcfg-rh-inotify-update-fix.patch:

--- NEW FILE ifcfg-rh-inotify-update-fix.patch ---
diff --git a/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
index 7e18ed0..bfc36af 100644
--- a/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
+++ b/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
@@ -317,27 +317,27 @@ nm_ifcfg_connection_get_unmanaged (NMIfcfgConnection *self)
 	return NM_IFCFG_CONNECTION_GET_PRIVATE (self)->unmanaged;
 }
 
-static gboolean
-update (NMExportedConnection *exported, GHashTable *new_settings, GError **error)
+gboolean
+nm_ifcfg_connection_update (NMIfcfgConnection *self, GHashTable *new_settings, GError **error)
 {
+	NMExportedConnection *exported = NM_EXPORTED_CONNECTION (self);
 	NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (exported);
-	gboolean success;
 	NMConnection *connection;
 
-	success = NM_EXPORTED_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->update (exported, new_settings, error);
-	if (success) {
-		connection = nm_exported_connection_get_connection (exported);
-		success = nm_connection_replace_settings (connection, new_settings, error);
-		if (success) {
-			success = writer_update_connection (connection,
-			                                    IFCFG_DIR,
-			                                    priv->filename,
-			                                    priv->keyfile,
-			                                    error);
-		}
-	}
+	connection = nm_exported_connection_get_connection (exported);
+	if (!nm_connection_replace_settings (connection, new_settings, error))
+		return FALSE;
+
+	return writer_update_connection (connection, IFCFG_DIR, priv->filename, priv->keyfile, error);
+}
+
+static gboolean
+update (NMExportedConnection *exported, GHashTable *new_settings, GError **error)
+{
+	if (!NM_EXPORTED_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->update (exported, new_settings, error))
+		return FALSE;
 
-	return success;
+	return nm_ifcfg_connection_update (NM_IFCFG_CONNECTION (exported), new_settings, error);
 }
 
 static gboolean
diff --git a/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.h b/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.h
index f2a8c6d..dc13aa6 100644
--- a/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.h
+++ b/system-settings/plugins/ifcfg-rh/nm-ifcfg-connection.h
@@ -60,6 +60,10 @@ const char *nm_ifcfg_connection_get_udi (NMIfcfgConnection *self);
 
 gboolean nm_ifcfg_connection_get_unmanaged (NMIfcfgConnection *self);
 
+gboolean nm_ifcfg_connection_update (NMIfcfgConnection *self,
+                                     GHashTable *new_settings,
+                                     GError **error);
+
 G_END_DECLS
 
 #endif /* NM_IFCFG_CONNECTION_H */
diff --git a/system-settings/plugins/ifcfg-rh/plugin.c b/system-settings/plugins/ifcfg-rh/plugin.c
index 25d93b9..976090c 100644
--- a/system-settings/plugins/ifcfg-rh/plugin.c
+++ b/system-settings/plugins/ifcfg-rh/plugin.c
@@ -293,9 +293,9 @@ connection_changed_handler (SCPluginIfcfg *plugin,
 		/* errors reading connection; remove it */
 		if (!ignore_error) {
 			PLUGIN_WARN (IFCFG_PLUGIN_NAME, "    error: %s",
-			             error->message ? error->message : "(unknown)");
+			             (error && error->message) ? error->message : "(unknown)");
 		}
-		g_error_free (error);
+		g_clear_error (&error);
 
 		PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "removed %s.", path);
 		*do_remove = TRUE;
@@ -336,7 +336,11 @@ connection_changed_handler (SCPluginIfcfg *plugin,
 		/* Only update if different */
 		if (!nm_connection_compare (new_wrapped, old_wrapped, NM_SETTING_COMPARE_FLAG_EXACT)) {
 			settings = nm_connection_to_hash (new_wrapped);
-			nm_exported_connection_update (NM_EXPORTED_CONNECTION (connection), settings, NULL);
+			if (!nm_ifcfg_connection_update (connection, settings, &error)) {
+				PLUGIN_WARN (IFCFG_PLUGIN_NAME, "    error updating: %s",
+				             (error && error->message) ? error->message : "(unknown)");
+				g_clear_error (&error);
+			}
 			g_hash_table_destroy (settings);
 		}
 


Index: NetworkManager.spec
===================================================================
RCS file: /cvs/pkgs/rpms/NetworkManager/F-11/NetworkManager.spec,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -r1.271 -r1.272
--- NetworkManager.spec	14 Apr 2009 22:26:14 -0000	1.271
+++ NetworkManager.spec	16 Apr 2009 14:49:25 -0000	1.272
@@ -18,7 +18,7 @@
 Summary: Network connection manager and user applications
 Epoch: 1
 Version: 0.7.1
-Release: 2%{snapshot}%{?dist}
+Release: 3%{snapshot}%{?dist}
 Group: System Environment/Base
 License: GPLv2+
 URL: http://www.gnome.org/projects/NetworkManager/
@@ -28,6 +28,7 @@
 Source2: nm-system-settings.conf
 Patch1: nm-applet-internal-buildfixes.patch
 Patch2: explain-dns1-dns2.patch
+Patch3: ifcfg-rh-inotify-update-fix.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 PreReq:   chkconfig
@@ -146,6 +147,7 @@
 tar -xjf %{SOURCE1}
 %patch1 -p1 -b .buildfix
 %patch2 -p1 -b .explain-dns1-dns2
+%patch3 -p1 -b .ifcfg-rh-inotify-fix
 
 %build
 
@@ -326,6 +328,9 @@
 %{_datadir}/gtk-doc/html/libnm-util/*
 
 %changelog
+* Thu Apr 16 2009 Dan Williams <dcbw at redhat.com> - 1:0.7.1-3.git20090414
+- ifcfg-rh: fix problems noticing changes via inotify (rh #495884)
+
 * Tue Apr 14 2009 Dan Williams <dcbw at redhat.com> - 1:0.7.1-2.git20090414
 - ifcfg-rh: enable write support for wired and wifi connections
 




More information about the scm-commits mailing list