aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-12-13 03:44:45 +0000
committerYang Tse <yangsita@gmail.com>2009-12-13 03:44:45 +0000
commit303f74c740b45954d8883b318a931ff5633fe053 (patch)
treec0a5b7006d57d4b6691885730386ba97ce948118
parent4ea8ad584bf1338af4d72755bef56014c76b03f8 (diff)
reapply diff between revisions 1.103 and 1.102
-rw-r--r--tests/ftpserver.pl14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index d7c4d54d9..812f77975 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -138,16 +138,16 @@ if($proto !~ /^(ftp|imap|pop3|smtp)\z/) {
sub catch_zap {
my $signame = shift;
- print STDERR "ftpserver.pl received SIG$signame, exiting\n";
ftpkillslaves(1);
+ unlink($pidfile);
if($serverlogslocked) {
$serverlogslocked = 0;
clear_advisor_read_lock($SERVERLOGS_LOCK);
}
- die "Somebody sent me a SIG$signame";
+ exit;
}
$SIG{INT} = \&catch_zap;
-$SIG{KILL} = \&catch_zap;
+$SIG{TERM} = \&catch_zap;
my $sfpid;
@@ -169,6 +169,7 @@ sub sysread_or_die {
logmsg "Error: ftp$ftpdnum$ext sysread error: $!\n";
kill(9, $sfpid);
waitpid($sfpid, 0);
+ unlink($pidfile);
if($serverlogslocked) {
$serverlogslocked = 0;
clear_advisor_read_lock($SERVERLOGS_LOCK);
@@ -182,6 +183,7 @@ sub sysread_or_die {
logmsg "Error: ftp$ftpdnum$ext read zero\n";
kill(9, $sfpid);
waitpid($sfpid, 0);
+ unlink($pidfile);
if($serverlogslocked) {
$serverlogslocked = 0;
clear_advisor_read_lock($SERVERLOGS_LOCK);
@@ -207,6 +209,7 @@ sub startsf {
logmsg "Failed sockfilt command: $cmd\n";
kill(9, $sfpid);
waitpid($sfpid, 0);
+ unlink($pidfile);
if($serverlogslocked) {
$serverlogslocked = 0;
clear_advisor_read_lock($SERVERLOGS_LOCK);
@@ -215,9 +218,6 @@ sub startsf {
}
}
-# remove the file here so that if startsf() fails, it is very noticeable
-unlink($pidfile);
-
startsf();
logmsg sprintf("%s server listens on port IPv%d/$port\n", uc($proto),
@@ -1110,6 +1110,8 @@ while(1) {
print SFWRITE "QUIT\n";
waitpid $sfpid, 0;
+unlink($pidfile);
+
if($serverlogslocked) {
$serverlogslocked = 0;
clear_advisor_read_lock($SERVERLOGS_LOCK);