From 9d8a543c65104b1b4cc84cfcb3cd9910a33dff09 Mon Sep 17 00:00:00 2001 From: yinle Date: Tue, 14 Dec 2010 13:34:10 +0000 Subject: [PATCH] modify the getipaddr so that it would not warning when can't find the according hostname of a IP. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8400 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/NetworkUtils.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 4bf0dbd03..6a9228c73 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -151,7 +151,9 @@ sub gethostname() return undef; } my $hostname = gethostbyaddr(inet_aton($iporhost), AF_INET); - $hostname =~ s/\..*//; #short hostname + if ( $hostname ) { + $hostname =~ s/\..*//; #short hostname + } return $hostname; } }