add the localhost entry automatically when running the makehosts -n

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5810 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
daniceexi 2010-04-19 12:20:47 +00:00
parent f7632e01a5
commit 89b7726564

View File

@ -173,6 +173,13 @@ sub process_request {
if (-e "/etc/hosts") {
my $bakname = "/etc/hosts.xcatbak";
rename("/etc/hosts",$bakname);
# add the localhost entry if trying to create the /etc/hosts from scratch
if ($^O =~ /^aix/i) {
push @hosts, "127.0.0.1 loopback localhost\n";
} else {
push @hosts, "127.0.0.1 localhost\n";
}
}
} else {
if (-e "/etc/hosts") {
@ -217,7 +224,10 @@ sub process_request {
}
}
writeout();
flock($lockh,LOCK_UN);
if ($lockh) {
flock($lockh,LOCK_UN);
}
}