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