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