Deal with maildir quota file races.
authorPhil Pennock <pdp@exim.org>
Mon, 21 Feb 2011 05:38:07 +0000 (00:38 -0500)
committerPhil Pennock <pdp@exim.org>
Mon, 21 Feb 2011 05:39:09 +0000 (00:39 -0500)
Based on patch from Heiko Schlittermann.
Fixes bug 1086.

doc/doc-txt/ChangeLog
src/src/transports/appendfile.c
src/src/transports/tf_maildir.c

index 1fb19ca..3764a88 100644 (file)
@@ -66,6 +66,9 @@ PP/11 Bugzilla 1055: Update $message_linecount for maildir_tag.
 PP/12 Bugzilla 1056: Improved spamd server selection.
       Patch from Mark Zealey.
 
+PP/13 Bugzilla 1086: Deal with maildir quota file races.
+      Based on patch from Heiko Schlittermann.
+
 
 Exim version 4.74
 -----------------
index 6dbb352..e5ab657 100644 (file)
@@ -2419,9 +2419,18 @@ else
           "%s/maildirsize", check_path);
         return FALSE;
         }
+      else if (maildirsize_fd == -2)
+        {
+        DEBUG(D_transport) debug_printf("disabling quota check because of "
+          "races updating %s/maildirsize", check_path);
+        disable_quota = TRUE;
+        }
 
-      if (mailbox_size < 0) mailbox_size = size;
-      if (mailbox_filecount < 0) mailbox_filecount = filecount;
+      if (maildirsize_fd >= 0)
+        {
+        if (mailbox_size < 0) mailbox_size = size;
+        if (mailbox_filecount < 0) mailbox_filecount = filecount;
+        }
       }
 
     /* No quota enforcement; ensure file does *not* exist; calculate size if
index 7411d9a..472b076 100644 (file)
@@ -584,7 +584,7 @@ else
       "a later subdirectory modification\n");
     (void)Uunlink(filename);
     (void)close(fd);
-    fd = -1;
+    fd = -2;
     }
   }