You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2009/02/04 19:27:30 UTC
svn commit: r740818 - /spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Author: mmartinec
Date: Wed Feb 4 18:27:29 2009
New Revision: 740818
URL: http://svn.apache.org/viewvc?rev=740818&view=rev
Log:
Util::helper_app_pipe_open_unix: flush stdout and stderr before
forking, otherwise an error reported by exec (such as 'insecure
dependency') was lost in a buffer; also, change last-resort
subprocess exit code from 1 to 6 to make it less likely to be
confused with some regular external program exit status
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=740818&r1=740817&r2=740818&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Wed Feb 4 18:27:29 2009
@@ -65,6 +65,7 @@
use Mail::SpamAssassin::Util::RegistrarBoundaries;
use Config;
+use IO::Handle;
use File::Spec;
use File::Basename;
use Time::Local;
@@ -1432,7 +1433,7 @@
eval { warn $msg }; # hmm, STDERR may no longer be open
eval { dbg("util: force_die: $msg") };
- POSIX::_exit(1); # avoid END and destructor processing
+ POSIX::_exit(6); # avoid END and destructor processing
kill('KILL',$$); # still kicking? die!
}
@@ -1504,6 +1505,8 @@
# die "setuid: oops: fileno(STDOUT) [".fileno(STDOUT)."] != 1";
# }
+ STDOUT->autoflush(1);
+
if ($duperr2out) { # 2>&1
my $f = fileno(STDERR);
close STDERR or die "error closing STDERR: $!";
@@ -1514,6 +1517,7 @@
}
open (STDERR, ">&STDOUT") or die "dup STDOUT failed: $!";
+ STDERR->autoflush(1); # make sure not to lose diagnostics if exec fails
# STDERR must be fd 2 to be useful to subprocesses! (bug 3649)
if (fileno(STDERR) != 2) {