--- a/src.lock_maildirsize Sat Feb 26 22:52:11 2011 +0100
+++ b/src.lock_maildirsize Tue Mar 08 11:11:21 2011 +0100
@@ -3,7 +3,7 @@
diff -r 64ab3b627703 src/transports/appendfile.c
--- a/src/transports/appendfile.c Thu Feb 24 20:29:56 2011 +0100
-+++ b/src/transports/appendfile.c Sat Feb 26 22:51:42 2011 +0100
++++ b/src/transports/appendfile.c Sun Feb 27 21:51:22 2011 +0100
@@ -13,6 +13,7 @@
#ifdef SUPPORT_MAILDIR
@@ -94,16 +94,20 @@
if (mailbox_size < 0) mailbox_size = size;
if (mailbox_filecount < 0) mailbox_filecount = filecount;
}
-@@ -3125,6 +3150,8 @@
+@@ -3125,6 +3150,12 @@
uschar *renamename = newname;
fd = -1;
-+ if (lockfd >= 0) hs12_lock(lockfd, F_RDLCK, "for delivery");
++ /* we could get a timeout here, but we don't check for it. Thus it *may*
++ happen, that we deliver during an active RECALC process. Shit happens and it
++ will cause the RECALC to discard its result... */
++
++ if (lockfd >= 0) hs12_lock(lockfd, F_RDLCK, "for renaming temporary file");
+
DEBUG(D_transport) debug_printf("renaming temporary file\n");
/* If there is no rename name set, we are in a non-maildir, non-mailstore
-@@ -3245,6 +3272,7 @@
+@@ -3245,6 +3276,7 @@
filename = dataname = NULL; /* Prevents attempt to unlink at end */
}
} /* maildir or mailstore */
@@ -111,7 +115,7 @@
} /* successful write + close */
} /* isdirectory */
} /* write success */
-@@ -3280,6 +3308,11 @@
+@@ -3280,6 +3312,11 @@
detected, in order to get the file closed and the lock file tidied away. */
RETURN:
@@ -125,7 +129,7 @@
if (mbx_lockfd >= 0)
diff -r 64ab3b627703 src/transports/appendfile.h
--- a/src/transports/appendfile.h Thu Feb 24 20:29:56 2011 +0100
-+++ b/src/transports/appendfile.h Sat Feb 26 22:51:42 2011 +0100
++++ b/src/transports/appendfile.h Sun Feb 27 21:51:22 2011 +0100
@@ -95,5 +95,8 @@
/* Function that is shared with tf_maildir.c */
@@ -137,7 +141,7 @@
/* End of transports/appendfile.h */
diff -r 64ab3b627703 src/transports/tf_maildir.c
--- a/src/transports/tf_maildir.c Thu Feb 24 20:29:56 2011 +0100
-+++ b/src/transports/tf_maildir.c Sat Feb 26 22:51:42 2011 +0100
++++ b/src/transports/tf_maildir.c Sun Feb 27 21:51:22 2011 +0100
@@ -367,13 +367,16 @@
Returns: >=0 a file descriptor for an open maildirsize file
@@ -246,7 +250,7 @@
*returned_size = size;
diff -r 64ab3b627703 src/transports/tf_maildir.h
--- a/src/transports/tf_maildir.h Thu Feb 24 20:29:56 2011 +0100
-+++ b/src/transports/tf_maildir.h Sat Feb 26 22:51:42 2011 +0100
++++ b/src/transports/tf_maildir.h Sun Feb 27 21:51:22 2011 +0100
@@ -16,7 +16,7 @@
uschar *);
extern int maildir_ensure_sizefile(uschar *,