From 58cce1ab30325c1a0b08234575b95f339ad35c44 Mon Sep 17 00:00:00 2001 From: Devin Carraway Date: Sun, 10 Jul 2005 11:38:40 +0000 Subject: [PATCH] Clean up PID file on exit, if enabled git-svn-id: https://svn.perl.org/qpsmtpd/trunk@492 958fd67b-6ff1-0310-b445-bb7760255be9 --- qpsmtpd-forkserver | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qpsmtpd-forkserver b/qpsmtpd-forkserver index 5971e52..c89b8ef 100755 --- a/qpsmtpd-forkserver +++ b/qpsmtpd-forkserver @@ -23,7 +23,7 @@ my $PORT = 2525; # port number my @LOCALADDR; # ip address(es) to bind to my $USER = 'smtpd'; # user to suid to my $MAXCONNIP = 5; # max simultaneous connections from one IP -my $PID_FILE = ''; +my $PID_FILE = ''; # file to which server PID will be written sub usage { print <<"EOT"; @@ -78,6 +78,9 @@ sub REAPER { sub HUNTSMAN { $SIG{CHLD} = 'DEFAULT'; kill 'INT' => keys %childstatus; + if ($PID_FILE && -e $PID_FILE) { + unlink $PID_FILE or ::log(LOGERROR, "unlink: $PID_FILE: $!"); + } exit(0); }