From 3a7f5ae1826212cfb15c063f121dc004fc76be08 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 13 May 2010 18:41:08 +0000 Subject: [PATCH] -Fix possibility of missing ssh exit codes in psh git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6094 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/psh | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/xCAT-client/bin/psh b/xCAT-client/bin/psh index 46b533626..d6c171b3d 100755 --- a/xCAT-client/bin/psh +++ b/xCAT-client/bin/psh @@ -87,23 +87,6 @@ my %pids; # pid => node my %exitcodes; # Keep a list of children with known exit codes my %foundcodes; -# This happens whenever a child dies; keeps track of exit codes. -sub handle_chld { - my $pid; - my $lasterr=$?>>8; - my $foundproc=0; - while (($pid = waitpid(-1,WNOHANG)) > 0) { - $foundproc=1; - $exitcodes{$pids{$pid}} = $? >> 8; - $children--; - } - unless ($foundproc) { #Above loop mysteriously had no children, store previous $? as a candidate for omitted return codes - $foundcodes{$lasterr}=1; - $children--; #Free a slot from the child that must have sent this signal - } -} -$SIG{CHLD} = \&handle_chld; - if ($interface) { foreach (@nodes) { s/$/-$interface/; @@ -159,6 +142,8 @@ sub processoutput { #This way, one arbiter handles output, no interrupting unless ($line) { $inputs->remove($readyh); close($readyh); + $exitcodes{$nodehdl{$readyh}} = $? >> 8; + $children--; next; } chomp($line);