mirror of
https://github.com/curl/curl.git
synced 2026-06-03 06:54:14 +03:00
Fix warning "Use of uninitialized value in ...".
If the list has only one item avoid sort subroutine.
This commit is contained in:
parent
74ddbd8a3b
commit
2e17a97474
1 changed files with 15 additions and 6 deletions
21
tests/ftp.pm
21
tests/ftp.pm
|
|
@ -55,12 +55,14 @@ sub pidfromfile {
|
|||
if(open(PIDF, "<$pidfile")) {
|
||||
my $pidline = <PIDF>;
|
||||
close(PIDF);
|
||||
chomp $pidline;
|
||||
$pidline =~ s/^\s+//;
|
||||
$pidline =~ s/\s+$//;
|
||||
$pidline =~ s/^[+-]?0+//;
|
||||
if($pidline =~ $pidpattern) {
|
||||
$pid = $1;
|
||||
if($pidline) {
|
||||
chomp $pidline;
|
||||
$pidline =~ s/^\s+//;
|
||||
$pidline =~ s/\s+$//;
|
||||
$pidline =~ s/^[+-]?0+//;
|
||||
if($pidline =~ $pidpattern) {
|
||||
$pid = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -150,6 +152,13 @@ sub signalpids {
|
|||
if((not defined $signal) || (not defined $pids)) {
|
||||
return;
|
||||
}
|
||||
if($pids !~ /\s+/) {
|
||||
# avoid sorting if only one pid
|
||||
if(checkalivepid($pids) > 0) {
|
||||
kill($signal, $pids);
|
||||
}
|
||||
return;
|
||||
}
|
||||
my $prev = 0;
|
||||
for(sort({$a <=> $b} split(" ", $pids))) {
|
||||
if($_ =~ $pidpattern) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue