-defect 2817258 is fixed; add the check point for inet_ntoa

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3840 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mxi1 2009-07-21 06:48:40 +00:00
parent 5c0eb55659
commit b2e83c7cc1

View File

@ -135,7 +135,17 @@ sub addnode
$nrent = $nrhash->{$node}->[0];
if ($nrent and $nrent->{tftpserver})
{
$tftpserver = inet_ntoa(inet_aton($nrent->{tftpserver}));
#check the value of inet_ntoa(inet_aton("")),if the hostname cannot be resolved,
#the value of inet_ntoa() will be "undef", which will cause fatal error
my $tmp_name = inet_aton($nrent->{tftpserver});
unless($tmp_name) {
#tell the reason to the user
$callback->(
{ error => ["Unable to resolve the tftpserver for node"], errorcode => [1]}
);
return;
}
$tftpserver = inet_ntoa($tmp_name);
$lstatements =
'next-server '
. $tftpserver . ';'