aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);