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/07/16 04:50:07 UTC

svn commit: rev 22948 - spamassassin/trunk/lib/Mail/SpamAssassin

Author: felicity
Date: Thu Jul 15 19:50:06 2004
New Revision: 22948

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
Log:
bug 3608: razor keeps its logfile open after processing completes, so we need to close it, as long as the logfile isn't STDOUT or STDERR.

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm	Thu Jul 15 19:50:06 2004
@@ -432,6 +432,23 @@
 	  # if we got here, we're done doing remote stuff, abort the alert
 	  alarm 0;
 
+          # figure out if we have a log file we need to close...
+          if (ref($rc->{logref}) && exists $rc->{logref}->{fd}) {
+            # the fd can be stdout or stderr, so we need to find out if it is
+	    # so we don't close them by accident.  Note: we can't just
+	    # undef the fd here (like the IO::Handle manpage says we can)
+	    # because it won't actually close, unfortunately. :(
+            my $untie = 1;
+            foreach my $log ( *STDOUT{IO}, *STDERR{IO} ) {
+              if ($log == $rc->{logref}->{fd}) {
+                $untie = 0;
+                last;
+              }
+            }
+            close $rc->{logref}->{fd} if ($untie);
+          }
+
+
 	  dbg("Using results from Razor v".$Razor2::Client::Version::VERSION);
 
 	  # so $objects->[0] is the first (only) message, and ->{spam} is a general yes/no