# stop it, otherwise reap it if this has not been done yet.
my @signalled;
my $prev = 0;
- my @pids = sort({$a <=> $b} split(/\s+/, $pidlist));
+ my @pids = split(' ', $pidlist);
+ if(scalar(@pids) > 2) {
+ my @sorted = sort({$a <=> $b} @pids);
+ @pids = @sorted;
+ }
foreach my $tmp (@pids) {
chomp $tmp;
if($tmp =~ /^(\d+)$/) {
my $pid;
my $prev;
- foreach $pid (split(/\s+/, $pids)) {
+ foreach $pid (split(' ', $pids)) {
if($pid != $prev) {
# no need to kill same pid twice!
logmsg sprintf("* kill pid for %s => %d\n",
logmsg("Sent off %zd bytes", written);
}
/* write to file as well */
- fwrite(buffer, 1, written, dump);
+ fwrite(buffer, 1, (size_t)written, dump);
if(got_exit_signal)
break;