mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
Fix warnings
This commit is contained in:
parent
c74875d94e
commit
ae3892e8ab
21
tests/ftp.pm
21
tests/ftp.pm
@ -87,7 +87,7 @@ sub killpid {
|
|||||||
|
|
||||||
# Make 'requested' hold the non-duplicate pids from 'pidlist'.
|
# Make 'requested' hold the non-duplicate pids from 'pidlist'.
|
||||||
@requested = split(' ', $pidlist);
|
@requested = split(' ', $pidlist);
|
||||||
return if(not defined(@requested));
|
return if(not @requested);
|
||||||
if(scalar(@requested) > 2) {
|
if(scalar(@requested) > 2) {
|
||||||
@requested = sort({$a <=> $b} @requested);
|
@requested = sort({$a <=> $b} @requested);
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ sub killpid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Allow all signalled processes five seconds to gracefully die.
|
# Allow all signalled processes five seconds to gracefully die.
|
||||||
if(defined(@signalled)) {
|
if(@signalled) {
|
||||||
my $twentieths = 5 * 20;
|
my $twentieths = 5 * 20;
|
||||||
while($twentieths--) {
|
while($twentieths--) {
|
||||||
for(my $i = scalar(@signalled) - 1; $i >= 0; $i--) {
|
for(my $i = scalar(@signalled) - 1; $i >= 0; $i--) {
|
||||||
@ -141,7 +141,7 @@ sub killpid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Mercilessly SIGKILL processes still alive.
|
# Mercilessly SIGKILL processes still alive.
|
||||||
if(defined(@signalled)) {
|
if(@signalled) {
|
||||||
foreach my $pid (@signalled) {
|
foreach my $pid (@signalled) {
|
||||||
if($pid > 0) {
|
if($pid > 0) {
|
||||||
print("RUN: Process with pid $pid forced to die with SIGKILL\n")
|
print("RUN: Process with pid $pid forced to die with SIGKILL\n")
|
||||||
@ -155,7 +155,7 @@ sub killpid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Reap processes dead children for sure.
|
# Reap processes dead children for sure.
|
||||||
if(defined(@reapchild)) {
|
if(@reapchild) {
|
||||||
foreach my $pid (@reapchild) {
|
foreach my $pid (@reapchild) {
|
||||||
if($pid > 0) {
|
if($pid > 0) {
|
||||||
waitpid($pid, 0);
|
waitpid($pid, 0);
|
||||||
@ -169,13 +169,12 @@ sub killpid {
|
|||||||
#
|
#
|
||||||
sub ftpkillslave {
|
sub ftpkillslave {
|
||||||
my ($id, $ext, $verbose)=@_;
|
my ($id, $ext, $verbose)=@_;
|
||||||
my $base;
|
|
||||||
|
|
||||||
for $base (('filt', 'data')) {
|
for my $base (('filt', 'data')) {
|
||||||
my $f = ".sock$base$id$ext.pid";
|
my $f = ".sock$base$id$ext.pid";
|
||||||
my $pid = processexists($f);
|
my $pid = processexists($f);
|
||||||
if($pid > 0) {
|
if($pid > 0) {
|
||||||
printf ("* kill pid for %s => %d\n", "ftp-$base$id$ext", $pid)
|
printf("* kill pid for %s => %d\n", "ftp-$base$id$ext", $pid)
|
||||||
if($verbose);
|
if($verbose);
|
||||||
kill (9, $pid);
|
kill (9, $pid);
|
||||||
waitpid($pid, 0);
|
waitpid($pid, 0);
|
||||||
@ -191,13 +190,13 @@ sub ftpkillslave {
|
|||||||
sub ftpkillslaves {
|
sub ftpkillslaves {
|
||||||
my ($verbose) = @_;
|
my ($verbose) = @_;
|
||||||
|
|
||||||
for $ext (('', 'ipv6')) {
|
for my $ext (('', 'ipv6')) {
|
||||||
for $id (('', '2')) {
|
for my $id (('', '2')) {
|
||||||
for $base (('filt', 'data')) {
|
for my $base (('filt', 'data')) {
|
||||||
my $f = ".sock$base$id$ext.pid";
|
my $f = ".sock$base$id$ext.pid";
|
||||||
my $pid = processexists($f);
|
my $pid = processexists($f);
|
||||||
if($pid > 0) {
|
if($pid > 0) {
|
||||||
printf ("* kill pid for %s => %d\n", "ftp-$base$id$ext",
|
printf("* kill pid for %s => %d\n", "ftp-$base$id$ext",
|
||||||
$pid) if($verbose);
|
$pid) if($verbose);
|
||||||
kill (9, $pid);
|
kill (9, $pid);
|
||||||
waitpid($pid, 0);
|
waitpid($pid, 0);
|
||||||
|
@ -157,7 +157,7 @@ sub ftpmsg {
|
|||||||
# better on windows/cygwin
|
# better on windows/cygwin
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
while(@ARGV) {
|
||||||
if($ARGV[0] eq "-v") {
|
if($ARGV[0] eq "-v") {
|
||||||
$verbose=1;
|
$verbose=1;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,8 @@ do {
|
|||||||
$listenaddr =~ s/^\[(.*)\]$/$1/;
|
$listenaddr =~ s/^\[(.*)\]$/$1/;
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
}
|
}
|
||||||
} while(shift @ARGV);
|
shift @ARGV;
|
||||||
|
};
|
||||||
|
|
||||||
# a dedicated protocol has been selected, check that it's a fine one
|
# a dedicated protocol has been selected, check that it's a fine one
|
||||||
if($proto !~ /^(ftp|imap|pop3|smtp)\z/) {
|
if($proto !~ /^(ftp|imap|pop3|smtp)\z/) {
|
||||||
@ -768,9 +769,11 @@ sub STOR_ftp {
|
|||||||
my $i;
|
my $i;
|
||||||
sysread DREAD, $i, 5;
|
sysread DREAD, $i, 5;
|
||||||
|
|
||||||
#print STDERR " GOT: $i";
|
my $size = 0;
|
||||||
|
if($i =~ /^([0-9a-fA-F]{4})\n/) {
|
||||||
|
$size = hex($1);
|
||||||
|
}
|
||||||
|
|
||||||
my $size = hex($i);
|
|
||||||
sysread DREAD, $line, $size;
|
sysread DREAD, $line, $size;
|
||||||
|
|
||||||
#print STDERR " GOT: $size bytes\n";
|
#print STDERR " GOT: $size bytes\n";
|
||||||
@ -840,8 +843,11 @@ sub PASV_ftp {
|
|||||||
# READ the response size
|
# READ the response size
|
||||||
sysread_or_die(\*DREAD, \$i, 5);
|
sysread_or_die(\*DREAD, \$i, 5);
|
||||||
|
|
||||||
my $size = hex($i);
|
my $size = 0;
|
||||||
|
if($i =~ /^([0-9a-fA-F]{4})\n/) {
|
||||||
|
$size = hex($1);
|
||||||
|
}
|
||||||
|
|
||||||
# READ the response data
|
# READ the response data
|
||||||
sysread_or_die(\*DREAD, \$i, $size);
|
sysread_or_die(\*DREAD, \$i, $size);
|
||||||
|
|
||||||
@ -1111,7 +1117,10 @@ while(1) {
|
|||||||
# SIZE of data
|
# SIZE of data
|
||||||
sysread_or_die(\*SFREAD, \$i, 5);
|
sysread_or_die(\*SFREAD, \$i, 5);
|
||||||
|
|
||||||
my $size = hex($i);
|
my $size = 0;
|
||||||
|
if($i =~ /^([0-9a-fA-F]{4})\n/) {
|
||||||
|
$size = hex($1);
|
||||||
|
}
|
||||||
|
|
||||||
# data
|
# data
|
||||||
sysread SFREAD, $_, $size;
|
sysread SFREAD, $_, $size;
|
||||||
@ -1163,24 +1172,30 @@ while(1) {
|
|||||||
my $text;
|
my $text;
|
||||||
$text = $customreply{$FTPCMD};
|
$text = $customreply{$FTPCMD};
|
||||||
my $fake = $text;
|
my $fake = $text;
|
||||||
if($text eq "") {
|
|
||||||
$text = $displaytext{$FTPCMD};
|
if($text && ($text ne "")) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
if($customcount{$FTPCMD} && (!--$customcount{$FTPCMD})) {
|
if($customcount{$FTPCMD} && (!--$customcount{$FTPCMD})) {
|
||||||
# used enough number of times, now blank the customreply
|
# used enough number of times, now blank the customreply
|
||||||
$customreply{$FTPCMD}="";
|
$customreply{$FTPCMD}="";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$text = $displaytext{$FTPCMD};
|
||||||
|
}
|
||||||
my $check;
|
my $check;
|
||||||
if($text) {
|
if($text && ($text ne "")) {
|
||||||
sendcontrol "$cmdid$text\r\n";
|
if($cmdid && ($cmdid ne "")) {
|
||||||
|
sendcontrol "$cmdid$text\r\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendcontrol "$text\r\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$check=1; # no response yet
|
$check=1; # no response yet
|
||||||
}
|
}
|
||||||
|
|
||||||
if($fake eq "") {
|
unless($fake && ($fake ne "")) {
|
||||||
# only perform this if we're not faking a reply
|
# only perform this if we're not faking a reply
|
||||||
my $func = $commandfunc{$FTPCMD};
|
my $func = $commandfunc{$FTPCMD};
|
||||||
if($func) {
|
if($func) {
|
||||||
|
Loading…
Reference in New Issue
Block a user