From 8658007548da7e3b7770204a5656b76d8fb05f36 Mon Sep 17 00:00:00 2001 From: ellen56 Date: Fri, 3 Jul 2009 13:13:02 +0000 Subject: [PATCH] make operation on /etc/services && /etc/inetd.conf safer git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3697 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/monitoring/rrdutil.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/rrdutil.pm b/xCAT-server/lib/xcat/monitoring/rrdutil.pm index 3f4d3f64f..f93a96962 100755 --- a/xCAT-server/lib/xcat/monitoring/rrdutil.pm +++ b/xCAT-server/lib/xcat/monitoring/rrdutil.pm @@ -55,9 +55,9 @@ sub start_RRD_server open FILE, ">/etc/services.new" or return -1; foreach (@old){ - print FILE "$_\n"; + print FILE "$_\n" or return -1; } - close FILE; + close FILE or return -1; $cmd = "mv -f /etc/services.new /etc/services"; xCAT::Utils->runcmd($cmd, -2); @@ -73,7 +73,7 @@ sub start_RRD_server @old = xCAT::Utils->runcmd("cat /etc/inetd.conf", -2); $offset = 0; $found = 0; - push @new, "rrdsrv stream tcp no wait root /usr/bin/rrdtool rrdtool - $dir"; + push @new, "rrdsrv stream tcp nowait root /usr/bin/rrdtool rrdtool - $dir"; foreach (@old) { if ($_ =~ /rrdsrv/){ if(!$found){ @@ -91,9 +91,9 @@ sub start_RRD_server } open FILE, ">/etc/inetd.conf.new" or return -1; foreach (@old){ - print FILE "$_\n"; + print FILE "$_\n" or return -1; } - close FILE; + close FILE or return -1; xCAT::Utils->runcmd("mv -f /etc/inetd.conf.new /etc/inetd.conf", -2); if(xCAT::Utils->isAIX()){ @@ -130,9 +130,9 @@ sub stop_RRD_server } open FILE, ">/etc/services.new" or return -1; foreach (@old){ - print FILE "$_\n"; + print FILE "$_\n" or return -1; } - close FILE; + close FILE or return -1; xCAT::Utils->runcmd("mv -f /etc/services.new /etc/services", -1); @old = (); @@ -147,9 +147,9 @@ sub stop_RRD_server } open FILE, ">/etc/inetd.conf.new" or return -1; foreach (@old){ - print FILE "$_\n"; + print FILE "$_\n" or return -1; } - close FILE; + close FILE or return -1; xCAT::Utils->runcmd("mv -f /etc/inetd.conf.new /etc/inetd.conf", -2); if(xCAT::Utils->isAIX()){ xCAT::Utils->runcmd("stopsrc -s inetd", 0);