From 660242ad27370c2190afb53bc50efa949b06f5f0 Mon Sep 17 00:00:00 2001 From: Phil Pennock Date: Mon, 21 Feb 2011 00:38:07 -0500 Subject: Deal with maildir quota file races. Based on patch from Heiko Schlittermann. Fixes bug 1086. --- src/src/transports/appendfile.c | 13 +++++++++++-- src/src/transports/tf_maildir.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index 6dbb35262..e5ab65765 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -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 diff --git a/src/src/transports/tf_maildir.c b/src/src/transports/tf_maildir.c index 7411d9a3e..472b0764d 100644 --- a/src/src/transports/tf_maildir.c +++ b/src/src/transports/tf_maildir.c @@ -584,7 +584,7 @@ else "a later subdirectory modification\n"); (void)Uunlink(filename); (void)close(fd); - fd = -1; + fd = -2; } } -- cgit v1.2.3