X-Git-Url: https://diplodocus.org/git/minc/blobdiff_plain/0f64dd0e875af195c098e7f1f10e5b93dc1b9fa0..1f7d1f021e1aeb2cf466bf23e4858cc8b157695f:/minc diff --git a/minc b/minc index 2d7cfbe..a534abc 100755 --- a/minc +++ b/minc @@ -212,7 +212,7 @@ sub log_headers { # Utility procedures sub _errprint { - printf("%s:%s", __FILE__, __LINE__); + printf('%s:%s', __FILE__, __LINE__); if (@_) { print(': '); @@ -276,6 +276,8 @@ sub store_message { my $mhmsg; my $msgnum; + # We must do this even in -n mode because later steps fail without + # it. This should be harmless. mkfolder($mhfolder); $mhmsg = `mhpath +$mhfolder new`; @@ -359,8 +361,10 @@ sub is_spam { logerr("$err: $message: $!"); - if (unlink($err) != 1) { - err(&EX_TEMPFAIL, "Failed unlink($err)"); + if ($run) { + if (unlink($err) != 1) { + err(&EX_TEMPFAIL, "Failed unlink($err)"); + } } } elsif (-f $sig) { # This is supposed to be a signature created with razor-check @@ -369,14 +373,20 @@ sub is_spam { # into razor-check. For now, just unlink any sig files we # find and proceed with full razor-check mode. - if (unlink($sig) != 1) { - err(&EX_TEMPFAIL, "Failed unlink($sig)"); + if ($run) { + if (unlink($sig) != 1) { + err(&EX_TEMPFAIL, "Failed unlink($sig)"); + } } } - $status = system("razor-check < $msg"); - if (WIFEXITED($status) and WEXITSTATUS($status) == 0) { - return 1; + if ($run) { + $status = system("razor-check < $msg"); + if (WIFEXITED($status) and WEXITSTATUS($status) == 0) { + return 1; + } else { + return 0; + } } else { return 0; } @@ -401,7 +411,7 @@ sub kill_spam { push(@result, $msg); } } - print("\nDone: ", scalar(@result), "\n"); + print("\nDone: ", scalar(@result), " survivors\n"); return @result; } @@ -427,7 +437,7 @@ sub find_mh_folder { log_headers(%headers); foreach $header (keys(%FILTERS)) { - $contents = $headers{$header}; + $contents = $headers{lc($header)}; if (defined($contents)) { foreach $regex (keys(%{$FILTERS{$header}})) {