dovecot-2.2: mbox: If mailbox_update() doesn't affect the mbox f...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 15 13:25:59 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/646c5d0a60b5
changeset: 15473:646c5d0a60b5
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 15 13:25:49 2012 +0200
description:
mbox: If mailbox_update() doesn't affect the mbox file, don't sync it.

diffstat:

 src/lib-storage/index/mbox/mbox-storage.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 0e88b2518e0f -r 646c5d0a60b5 src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c	Sat Dec 15 13:25:34 2012 +0200
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Sat Dec 15 13:25:49 2012 +0200
@@ -491,17 +491,21 @@
 mbox_mailbox_update(struct mailbox *box, const struct mailbox_update *update)
 {
 	struct mbox_mailbox *mbox = (struct mbox_mailbox *)box;
-	int ret;
+	int ret = 0;
 
 	if (!box->opened) {
 		if (mailbox_open(box) < 0)
 			return -1;
 	}
 
-	mbox->sync_hdr_update = update;
-	ret = mbox_sync(mbox, MBOX_SYNC_HEADER | MBOX_SYNC_FORCE_SYNC |
-			MBOX_SYNC_REWRITE);
-	mbox->sync_hdr_update = NULL;
+	if (update->uid_validity != 0 || update->min_next_uid != 0) {
+		mbox->sync_hdr_update = update;
+		ret = mbox_sync(mbox, MBOX_SYNC_HEADER | MBOX_SYNC_FORCE_SYNC |
+				MBOX_SYNC_REWRITE);
+		mbox->sync_hdr_update = NULL;
+	}
+	if (ret == 0)
+		ret = index_storage_mailbox_update(box, update);
 	return ret;
 }
 


More information about the dovecot-cvs mailing list