You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by ms...@apache.org on 2004/02/19 02:56:40 UTC

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

Author: mss
Date: Wed Feb 18 17:56:39 2004
New Revision: 6748

Modified:
   incubator/spamassassin/trunk/spamd/spamd.raw
Log:
Make the syslog-SIGPIPE-handler more local and make sure its always removed again (to avoid it being called if pipes to helper apps break).


Modified: incubator/spamassassin/trunk/spamd/spamd.raw
==============================================================================
--- incubator/spamassassin/trunk/spamd/spamd.raw	(original)
+++ incubator/spamassassin/trunk/spamd/spamd.raw	Wed Feb 18 17:56:39 2004
@@ -1355,11 +1355,6 @@
 
 sub logmsg
 {
-  # install a new handler for SIGPIPE -- this signal has been
-  # found to occur with syslog-ng after syslog-ng restarts.
-  my $orig_sigpipe_handler = $SIG{'PIPE'};
-  $SIG{'PIPE'} = sub { $main::SIGPIPE_RECEIVED++; };
-
   my $msg = join(" ", @_);
   $msg =~ s/[\r\n]+$//;      # remove any trailing newlines
   $msg =~ s/[[:cntrl:]]/_/g; # replace all other control chars with underscores
@@ -1387,6 +1382,10 @@
   }
   # log to syslog (if logging isn't disabled completely via 'null')
   elsif ($log_socket ne 'none') {
+    # install a new handler for SIGPIPE -- this signal has been
+    # found to occur with syslog-ng after syslog-ng restarts.
+    local $SIG{'PIPE'} = sub { $main::SIGPIPE_RECEIVED++ };
+
     openlog('spamd', 'cons,pid', $log_facility);
 
     eval { syslog('info', "%s", $msg); };
@@ -1418,8 +1417,6 @@
       }
     }
   }
-
-  $SIG{'PIPE'} = $orig_sigpipe_handler if defined($orig_sigpipe_handler);
 }
 
 sub kill_handler