]> diplodocus.org Git - minc/commitdiff
Audit the entire file for correct -n behavior.
authorepg <>
Sun, 25 Aug 2002 21:04:05 +0000 (21:04 +0000)
committerepg <>
Sun, 25 Aug 2002 21:04:05 +0000 (21:04 +0000)
(store_message): Document why this calls mkfolder even in -n mode.

(is_spam): Don't actually do anything in -n mode.

minc

diff --git a/minc b/minc
index 2f649e7..8c3d7f9 100755 (executable)
--- a/minc
+++ b/minc
@@ -276,6 +276,8 @@ sub store_message {
     my $mhmsg;
     my $msgnum;
 
     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`;
     mkfolder($mhfolder);
 
     $mhmsg = `mhpath +$mhfolder new`;
@@ -359,8 +361,10 @@ sub is_spam {
 
         logerr("$err: $message: $!");
 
 
         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
         }
     } 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.
 
         # 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;
     }
     } else {
         return 0;
     }