diff --git a/xCAT-client/bin/pscp b/xCAT-client/bin/pscp index ee3e7c2c6..0b57a6935 100755 --- a/xCAT-client/bin/pscp +++ b/xCAT-client/bin/pscp @@ -105,12 +105,9 @@ if ($interface) { foreach (@nodes) { my $node=$_; while ($children > $pshmaxp) { processoutput($inputs); } - my $child; $children++; #scpnode(\$child,$node,@ARGV[0],$destloc); - scpnode(\$child,$node,\@scpargs,$destloc); - $inputs->add($child); - $nodehdl{$child} = $node; + scpnode($inputs,\%nodehdl,$node,\@scpargs,$destloc); } while ($inputs->count and $children) { processoutput($inputs); @@ -139,6 +136,8 @@ sub processoutput { #This way, one arbiter handles output, no interrupting return $rc; } sub scpnode { + my $inputs = shift; + my $nodehdl = shift; my $out = shift; my $node = shift; my $in; @@ -147,7 +146,10 @@ sub scpnode { my $scpargsr = shift; my @scpargs = @{$scpargsr}; my $dest = shift; - open($$out, "scp -o BatchMode=yes @scpargs $node:$dest 2>&1 |"); + my $child; + open($child, "scp -o BatchMode=yes @scpargs $node:$dest 2>&1 |"); + $inputs->add($child); + $nodehdl->{$child} = $node; } # vim: set et sw=2 ts=2 sts=2: