--- a/src.fixed_ensure_maildirsize Thu Feb 24 17:21:41 2011 +0100
+++ b/src.fixed_ensure_maildirsize Thu Feb 24 20:31:10 2011 +0100
@@ -1,35 +1,9 @@
# HG changeset patch
-# Parent bb312f4baa8351ad1e97b991721f71c4c96b13ac
+# Parent e46329bd93b89ef7f880988f37d6ad1b7fbe11c3
-diff -r bb312f4baa83 src/transports/appendfile.c
---- a/src/transports/appendfile.c Tue Feb 15 11:23:53 2011 +0100
-+++ b/src/transports/appendfile.c Fri Feb 18 00:02:06 2011 +0100
-@@ -1263,7 +1263,6 @@
-
- #ifdef SUPPORT_MAILDIR
- int maildirsize_fd = -1; /* fd for maildirsize file */
--int maildir_save_errno;
- #endif
-
-
-@@ -2911,11 +2910,12 @@
- #ifdef SUPPORT_MAILDIR
- if (!disable_quota)
- {
-+ int save_errno;
- if (yield == OK && maildirsize_fd >= 0)
- maildir_record_length(maildirsize_fd, message_size);
-- maildir_save_errno = errno; /* Preserve errno while closing the file */
-+ save_errno = errno; /* Preserve errno while closing the file */
- (void)close(maildirsize_fd);
-- errno = maildir_save_errno;
-+ errno = save_errno;
- }
- #endif /* SUPPORT_MAILDIR */
-
-diff -r bb312f4baa83 src/transports/tf_maildir.c
---- a/src/transports/tf_maildir.c Tue Feb 15 11:23:53 2011 +0100
-+++ b/src/transports/tf_maildir.c Fri Feb 18 00:02:06 2011 +0100
+diff -r e46329bd93b8 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 20:12:03 2011 +0100
@@ -584,7 +584,7 @@
"a later subdirectory modification\n");
(void)Uunlink(filename);
--- 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 *,