- ifcfg-rh: fix problems noticing changes via inotify (rh #495884)
This commit is contained in:
parent
8ad91932f7
commit
491e6da313
@ -18,7 +18,7 @@ Name: NetworkManager
|
||||
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 @@ Source1: network-manager-applet-%{version}%{applet_snapshot}.tar.bz2
|
||||
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 @@ NetworkManager functionality from applications that use glib.
|
||||
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 @@ fi
|
||||
%{_datadir}/gtk-doc/html/libnm-util/*
|
||||
|
||||
%changelog
|
||||
* Thu Apr 16 2009 Dan Williams <dcbw@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@redhat.com> - 1:0.7.1-2.git20090414
|
||||
- ifcfg-rh: enable write support for wired and wifi connections
|
||||
|
||||
|
92
ifcfg-rh-inotify-update-fix.patch
Normal file
92
ifcfg-rh-inotify-update-fix.patch
Normal file
@ -0,0 +1,92 @@
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user