From: epg <> Date: Sun, 25 Aug 2002 21:04:05 +0000 (+0000) Subject: Audit the entire file for correct -n behavior. X-Git-Url: https://diplodocus.org/git/minc/commitdiff_plain/586d29b9852f66b230d22780cc2ae956b63026b1?hp=8e7b24d27d6510c88ed3ba121605cf90e0b7f957 Audit the entire file for correct -n behavior. (store_message): Document why this calls mkfolder even in -n mode. (is_spam): Don't actually do anything in -n mode. --- diff --git a/minc b/minc index 2f649e7..8c3d7f9 100755 --- a/minc +++ b/minc @@ -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; }