http://bugzilla.spamassassin.org/show_bug.cgi?id=3625





------- Additional Comments From [EMAIL PROTECTED]  2004-08-31 11:24 -------
Based on what I saw last week, the syslog call (at least under 5.6.1) doesn't 
seem to fail.  Here's a diff that fixes the problem by saying if we receive 
SIGPIPE re-open syslog regardless of whether we got a syslog failure or not.  

Any flaws in this plan?  Do processes regularly get SIGPIPE calls that would 
make this a bad thing?  Anyway, here's the diff:

--- spamd.orig  Tue Aug 31 10:44:36 2004
+++ spamd       Tue Aug 31 12:01:02 2004
@@ -1679,19 +1679,13 @@

   # 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++ };
-
-  eval { syslog( 'info', "%s", $msg ); };
-
-  if ($@) {
-    if ($main::SIGPIPE_RECEIVED) {
-
+  local $SIG{'PIPE'} = sub {
+         $main::SIGPIPE_RECEIVED++;
       # SIGPIPE received when writing to syslog -- close and reopen
       # the log handle, then try again.
       closelog();
       openlog_for_spamd();
       syslog( 'debug', "%s", "syslog reopened" );
-      syslog( 'info', "%s", $msg );

       # now report what happend
       $msg = "SIGPIPE received, reopening log socket";
@@ -1703,10 +1697,12 @@
       if ( $main::SIGPIPE_RECEIVED > 1 ) {
         warn "logging failure: multiple SIGPIPEs received\n";
       }
-
       $main::SIGPIPE_RECEIVED = 0;
-    }
-    else {
+  };
+
+  eval { syslog( 'info', "%s", $msg ); };
+
+  if ($@) {
       warn "syslog() failed: $@"; # includes a \n

       # only write this warning once.  it gets annoying fast
@@ -1714,7 +1710,6 @@
         warn "try using --syslog-socket={unix,inet} or --syslog=file\n";
         $already_done_syslog_failure_warning = 1;
       }
-    }
   }
 }





------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to