commit 671c232544e109ab0289b6e099274fda54a35dbf
Author: Dan Williams <dcbw@redhat.com>
Date: Thu Feb 19 15:49:37 2009 -0500
ifcfg-rh: ignore explicitly set 'localhost' hostnames (rh #441453)
To match 'network' service behavior, which would perform reverse
address lookups when the HOSTNAME from /etc/sysconfig/network
was 'localhost' or 'localhost.localdomain'. Just name your machine
already.
diff --git a/system-settings/plugins/ifcfg-rh/plugin.c b/system-settings/plugins/ifcfg-rh/plugin.c
index e4f5bcf..b673615 100644
--- a/system-settings/plugins/ifcfg-rh/plugin.c
+++ b/system-settings/plugins/ifcfg-rh/plugin.c
@@ -499,6 +499,15 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
hostname = svGetValue (network, "HOSTNAME");
svCloseFile (network);
+
+ /* Ignore a hostname of 'localhost' or 'localhost.localdomain' to preserve
+ * 'network' service behavior.
+ */
+ if (hostname && (!strcmp (hostname, "localhost") || !strcmp (hostname, "localhost.localdomain"))) {
+ g_free (hostname);
+ hostname = NULL;
+ }
+
return hostname;
}