From 57893b9b318c140e6ad859bdfabd6c1b9a23d947 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 12 May 2011 17:26:57 +0000 Subject: [PATCH] fix defect 3301033 handle when /etc/resolv.conf does not exist or empty or git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9585 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index ab0e66743..8d889200a 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -859,12 +859,14 @@ sub initDB $master = "NORESOLUTION"; } # get forwarders which are the nameserver entries in /etc/resolv.conf + my $forwarders; my @names = - xCAT::Utils->runcmd( - "/bin/grep ^[^#]*nameserver /etc/resolv.conf | awk '{print \$2}'", - 0); - my $forwarders = join(',', @names); - + xCAT::Utils->runcmd( + "/bin/grep ^[^#]*nameserver /etc/resolv.conf | awk '{print \$2}'", -1); + if (@names) + { + $forwarders = join(',', @names); + } # for policy table # get hostname from the /etc/xcat/cert/server-cert.pem