--- a/src.lock_maildirsize Thu Feb 24 17:21:41 2011 +0100
+++ b/src.lock_maildirsize Thu Feb 24 20:31:10 2011 +0100
@@ -1,9 +1,9 @@
# HG changeset patch
-# Parent 52fd74447005c5bef643b4dbe767791d334312ad
+# Parent d242bf664878ef31577058ed193d7c04eb27f6d0
-diff -r 52fd74447005 OS/Makefile-Linux
---- a/OS/Makefile-Linux Thu Feb 24 17:19:04 2011 +0100
-+++ b/OS/Makefile-Linux Thu Feb 24 17:20:54 2011 +0100
+diff -r d242bf664878 OS/Makefile-Linux
+--- a/OS/Makefile-Linux Thu Feb 24 20:12:03 2011 +0100
++++ b/OS/Makefile-Linux Thu Feb 24 20:29:13 2011 +0100
@@ -16,7 +16,7 @@
DBMLIB = -ldb
USE_DB = yes
@@ -13,9 +13,9 @@
LIBRESOLV = -lresolv
X11=/usr/X11R6
-diff -r 52fd74447005 src/transports/appendfile.c
---- a/src/transports/appendfile.c Thu Feb 24 17:19:04 2011 +0100
-+++ b/src/transports/appendfile.c Thu Feb 24 17:20:54 2011 +0100
+diff -r d242bf664878 src/transports/appendfile.c
+--- a/src/transports/appendfile.c Thu Feb 24 20:12:03 2011 +0100
++++ b/src/transports/appendfile.c Thu Feb 24 20:29:13 2011 +0100
@@ -13,6 +13,7 @@
#ifdef SUPPORT_MAILDIR
@@ -83,7 +83,7 @@
#ifdef SUPPORT_MBX
/*************************************************
* Copy message into MBX mailbox *
-@@ -2416,18 +2440,19 @@
+@@ -2417,18 +2441,19 @@
{
off_t size;
int filecount;
@@ -135,9 +135,9 @@
#ifdef SUPPORT_MBX
if (mbx_lockfd >= 0)
-diff -r 52fd74447005 src/transports/appendfile.h
---- a/src/transports/appendfile.h Thu Feb 24 17:19:04 2011 +0100
-+++ b/src/transports/appendfile.h Thu Feb 24 17:20:54 2011 +0100
+diff -r d242bf664878 src/transports/appendfile.h
+--- a/src/transports/appendfile.h Thu Feb 24 20:12:03 2011 +0100
++++ b/src/transports/appendfile.h Thu Feb 24 20:29:13 2011 +0100
@@ -95,5 +95,8 @@
/* Function that is shared with tf_maildir.c */
@@ -147,9 +147,9 @@
+
/* End of transports/appendfile.h */
-diff -r 52fd74447005 src/transports/tf_maildir.c
---- a/src/transports/tf_maildir.c Thu Feb 24 17:19:04 2011 +0100
-+++ b/src/transports/tf_maildir.c Thu Feb 24 17:20:54 2011 +0100
+diff -r d242bf664878 src/transports/tf_maildir.c
+--- a/src/transports/tf_maildir.c Thu Feb 24 20:12:03 2011 +0100
++++ b/src/transports/tf_maildir.c Thu Feb 24 20:29:13 2011 +0100
@@ -367,13 +367,16 @@
Returns: >=0 a file descriptor for an open maildirsize file
@@ -168,7 +168,7 @@
{
int count, fd;
off_t cached_quota = 0;
-@@ -381,25 +384,48 @@
+@@ -381,19 +384,41 @@
int filecount = 0;
int linecount = 0;
off_t size = 0;
@@ -211,19 +211,18 @@
DEBUG(D_transport) debug_printf("looking for maildirsize in %s\n", path);
fd = Uopen(filename, O_RDWR|O_APPEND, ob->mode ? ob->mode : 0600);
-if (fd < 0)
-- {
-+if (fd < 0) {
++if (fd < 0)
+ {
if (errno != ENOENT) return -1;
DEBUG(D_transport)
- debug_printf("%s does not exist: recalculating\n", filename);
+@@ -401,6 +426,7 @@
goto RECALCULATE;
-- }
-+}
-+(void)lseek(fd, 0, SEEK_SET);
+ }
+
+
-
/* The file has been successfully opened. Check that the cached quota value is
still correct, and that the size of the file is still small enough. If so,
+ compute the maildir size from the file. */
@@ -520,16 +546,12 @@
}
}
@@ -258,14 +257,11 @@
if (fd >= 0) (void)close(fd);
old_latest = 0;
filecount = 0;
-@@ -586,10 +615,14 @@
- (void)close(fd);
- fd = -2;
+@@ -588,8 +617,11 @@
}
-+ hs12_lock(lockfd, F_UNLCK, "done recalc");
}
-+ hs12_lock(lockfd, F_UNLCK, "done check");
++ hs12_lock(lockfd, F_UNLCK, "done check");
+
+
+
@@ -274,9 +270,9 @@
DEBUG(D_transport) debug_printf("returning maildir size=" OFF_T_FMT
" filecount=%d\n", size, filecount);
*returned_size = size;
-diff -r 52fd74447005 src/transports/tf_maildir.h
---- a/src/transports/tf_maildir.h Thu Feb 24 17:19:04 2011 +0100
-+++ b/src/transports/tf_maildir.h Thu Feb 24 17:20:54 2011 +0100
+diff -r d242bf664878 src/transports/tf_maildir.h
+--- a/src/transports/tf_maildir.h Thu Feb 24 20:12:03 2011 +0100
++++ b/src/transports/tf_maildir.h Thu Feb 24 20:29:13 2011 +0100
@@ -16,7 +16,7 @@
uschar *);
extern int maildir_ensure_sizefile(uschar *,