$length==($_=read STDIN,$message,$length) or confess "Got $_ out of required $length bytes";
$length==length $message or confess "False read return ".length($message)." instead of $length";
{
- local *STDOUT;
- local *STDERR;
+ local *STDOUT; # FIXME: fd's inherited by spawned processes are not closed this way!
+ local *STDERR; # FIXME: fd's inherited by spawned processes are not closed this way!
local $DoBell=0;
process $message;
if ($DoBell) {
# return: true (error-message or "1") if is spam
sub spamassassin
{
+my($cmd)=@_;
+
+ $cmd||="spamassassin --exit-code";
# spamassassin has exit code 1 if IS spam, code 0 if NOT spam
local *CHILD;
local $SIG{"PIPE"}=sub { warn "spamassassin gave me SIGPIPE: broken pipe"; };
# prevent Razor2's: Can't call method "log" on unblessed reference at Razor2/Client/Agent.pm line 212.
local $ENV{"HOME"}=$HOME;
- open CHILD,'|spamassassin --exit-code --mbox >/dev/null'
+ # 2>/dev/null to prevent error messages to corrupt inetd() output of perlmail-accept(1)
+ open CHILD,"|$cmd --mbox >/dev/null 2>/dev/null"
or return 0;
print CHILD $Message;
my $return=close CHILD;