aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-05-02 10:22:09 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-05-02 10:22:09 +0000
commit669ebb5f7189089fd3fca1e7d3b70d8a8e407946 (patch)
tree4ada470fe9a05e9ca0e44e1a229bfc4f31f8cd9c
parent9a3e0e52cbb0999efb3906b67cbb94c22a37cb32 (diff)
Fixed the FTP server read stuff when waiting for a connect after a PASV/EPSV.
Made the ftp server use the passed in pidfile name, and made runtests.pl pass it in properly.
-rw-r--r--tests/ftpserver.pl13
-rwxr-xr-xtests/runtests.pl2
2 files changed, 10 insertions, 5 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index dd8383fa6..77c800221 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -76,6 +76,8 @@ my $ipv6;
my $ext; # append to log/pid file names
my $grok_eprt;
my $port = 8921; # just a default
+my $pidfile = ".ftpd.pid"; # a default, use --pidfile
+
do {
if($ARGV[0] eq "-v") {
$verbose=1;
@@ -88,6 +90,10 @@ do {
$ftpdnum=$ARGV[1];
shift @ARGV;
}
+ elsif($ARGV[0] eq "--pidfile") {
+ $pidfile=$ARGV[1];
+ shift @ARGV;
+ }
elsif($ARGV[0] eq "--ipv6") {
$ipv6="--ipv6";
$ext="ipv6";
@@ -129,12 +135,12 @@ sub startsf {
}
# remove the file here so that if startsf() fails, it is very noticable
-unlink(".ftp$ftpdnum.pid");
+unlink($pidfile);
startsf();
logmsg sprintf("FTP server started on port IPv%d/$port\n", $ipv6?6:4);
-open(PID, ">.ftp$ftpdnum.pid");
+open(PID, ">$pidfile");
print PID $$;
close(PID);
@@ -590,9 +596,8 @@ sub PASV_command {
# Wait for 'CNCT'
my $input;
- my $size;
- while(sysread(DREAD, $input, $size)) {
+ while(sysread(DREAD, $input, 5)) {
if($input !~ /^CNCT/) {
# we wait for a connected client
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 97b6c42b3..7f3059b77 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -553,7 +553,7 @@ sub runftpserver {
if($ipv6) {
$flag .="--ipv6 ";
}
- my $cmd="$perl $srcdir/ftpserver.pl $flag --port $port";
+ my $cmd="$perl $srcdir/ftpserver.pl --pidfile $pidfile $flag --port $port";
my $ftppid = startnew($cmd);