Diego warned me that the construct I used, signal sent to negative PID, is not portable. Replaced it with his construct, the negative signal. Also added the short sleep after socket close, as in his patch.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@948 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
77582b0b10
commit
f4afd7a18d
@ -19,6 +19,9 @@ use Qpsmtpd::TcpServer::Prefork;
|
|||||||
use Qpsmtpd::Constants;
|
use Qpsmtpd::Constants;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
|
||||||
|
use Config;
|
||||||
|
defined $Config{sig_name} || die "No signals?";
|
||||||
|
|
||||||
my $has_ipv6 = Qpsmtpd::TcpServer::has_ipv6;
|
my $has_ipv6 = Qpsmtpd::TcpServer::has_ipv6;
|
||||||
|
|
||||||
if ($has_ipv6) {
|
if ($has_ipv6) {
|
||||||
@ -27,6 +30,14 @@ if ($has_ipv6) {
|
|||||||
|
|
||||||
#use Time::HiRes qw(gettimeofday tv_interval);
|
#use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
|
|
||||||
|
#get available signals
|
||||||
|
my %sig_num;
|
||||||
|
my $i = 0;
|
||||||
|
foreach my $sig_name ( split( /\s/, $Config{sig_name} ) )
|
||||||
|
{
|
||||||
|
$sig_num{$sig_name} = $i++;
|
||||||
|
}
|
||||||
|
|
||||||
# secure shell
|
# secure shell
|
||||||
$ENV{'PATH'} = '/bin:/usr/bin';
|
$ENV{'PATH'} = '/bin:/usr/bin';
|
||||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||||
@ -227,11 +238,15 @@ sub run {
|
|||||||
# prevent another signal and disable reaper
|
# prevent another signal and disable reaper
|
||||||
$SIG{$sig} = $SIG{CHLD} = $SIG{HUP} = 'IGNORE';
|
$SIG{$sig} = $SIG{CHLD} = $SIG{HUP} = 'IGNORE';
|
||||||
|
|
||||||
|
# a notice, before the sleep below
|
||||||
|
info("shutting down");
|
||||||
|
|
||||||
# close socket
|
# close socket
|
||||||
$d->close();
|
$d->close();
|
||||||
|
sleep 2;
|
||||||
|
|
||||||
# send signal to process group
|
# send signal to process group
|
||||||
kill $sig, -$$;
|
kill -$sig_num{$sig} => $$;
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
IPC::Shareable->clean_up;
|
IPC::Shareable->clean_up;
|
||||||
|
Loading…
Reference in New Issue
Block a user