You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2004/04/27 02:32:38 UTC

svn commit: rev 10297 - incubator/spamassassin/trunk/spamd

Author: felicity
Date: Mon Apr 26 17:32:37 2004
New Revision: 10297

Modified:
   incubator/spamassassin/trunk/spamd/spamd.raw
Log:
digging around, SIGCHLD=IGNORE doesn't have guaranteed behavior on most platforms.  so change the restart and kill handlers appropriately -- kill sets to default then dies, restart sends kills and does a wait for each process.

Modified: incubator/spamassassin/trunk/spamd/spamd.raw
==============================================================================
--- incubator/spamassassin/trunk/spamd/spamd.raw	(original)
+++ incubator/spamassassin/trunk/spamd/spamd.raw	Mon Apr 26 17:32:37 2004
@@ -1490,22 +1490,32 @@
   # the UNIX domain socket
   defined( $opt{'socketpath'} ) and unlink( $opt{'socketpath'} );
 
-  $SIG{CHLD} = 'IGNORE';    # we're going to kill our children
+  $SIG{CHLD} = 'DEFAULT';    # we're going to kill our children
   kill 'INT' => keys %children;
   exit 0;
 }
 
 # takes care of dead children
 sub child_handler {
+  my ($sig) = @_;
   $SIG{CHLD} = \&child_handler;    # reset as necessary
   my $pid = wait;                  # reap the child
   delete $children{$pid};          # remove the child out of the pool
+  logmsg("server hit by SIG$sig, pid $pid");
 }
 
 sub restart_handler {
   my ($sig) = @_;
   logmsg("server hit by SIG$sig, restarting");
 
+  $SIG{CHLD} = 'DEFAULT';    # we're going to kill our children
+  foreach (keys %children) {
+    kill 'INT' => $_;
+    my $pid = wait;
+    logmsg("child $pid killed successfully");
+  }
+  %children = ();
+
   unless ( $server->eof ) {
     $server->shutdown(2);
     $server->close;
@@ -1516,10 +1526,6 @@
     warn "server socket closed\n" if $opt{'debug'};
   }
   $got_sighup = 1;
-
-  $SIG{CHLD} = 'IGNORE';    # we're going to kill our children
-  kill 'INT' => keys %children;
-  %children = ();
 }
 
 sub daemonize {