summary refs log tree commit diff
path: root/system-settings/plugins/ifupdown/plugin.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2010-11-29 19:00:22 +0100
committerMichael Biebl <biebl@debian.org>2010-11-29 19:00:22 +0100
commita6b89d35fabd9f5934b84d7cde22e9268f92c3d3 (patch)
tree9e44755880d5933fcc90c6008d4585a76298a1bd /system-settings/plugins/ifupdown/plugin.c
parent9fae01fa351805b2903e535736e06971bc0b925e (diff)
Imported Upstream version 0.8.2 upstream/0.8.2
Diffstat (limited to 'system-settings/plugins/ifupdown/plugin.c')
-rw-r--r--system-settings/plugins/ifupdown/plugin.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/system-settings/plugins/ifupdown/plugin.c b/system-settings/plugins/ifupdown/plugin.c
index e2358b9f..33c058e5 100644
--- a/system-settings/plugins/ifupdown/plugin.c
+++ b/system-settings/plugins/ifupdown/plugin.c
@@ -55,6 +55,8 @@
 #define G_UDEV_API_IS_SUBJECT_TO_CHANGE
 #include <gudev/gudev.h>
 
+#define ENI_INTERFACES_FILE "/etc/network/interfaces"
+
 #define IFUPDOWN_PLUGIN_NAME "ifupdown"
 #define IFUPDOWN_PLUGIN_INFO "(C) 2008 Canonical Ltd.  To report bugs please use the NetworkManager mailing list."
 #define IFUPDOWN_SYSTEM_HOSTNAME_FILE "/etc/hostname"
@@ -355,7 +357,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
 	update_system_hostname (inotify_helper, NULL, NULL, config);
 
 	/* Read in all the interfaces */
-	ifparser_init ();
+	ifparser_init (ENI_INTERFACES_FILE, 0);
 	block = ifparser_getfirst ();
 	while (block) {
 		if(!strcmp ("auto", block->type) || !strcmp ("allow-hotplug", block->type))
@@ -563,6 +565,12 @@ update_system_hostname(NMInotifyHelper *inotify_helper,
 
 	priv->hostname = g_strstrip(hostname_file);
 
+	/* We shouldn't return a zero-length hostname, but NULL */
+	if (priv->hostname && !strlen (priv->hostname)) {
+		g_free (priv->hostname);
+		priv->hostname = NULL;
+	}
+
 	g_object_notify (G_OBJECT (config), NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME);
 }