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.
This commit is contained in:
Dan Williams
2009-02-19 15:49:37 -05:00
parent 0393d4fa56
commit 3feb016594

View File

@@ -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;
}