dovecot-2.1: mdbox: mailbox_update() didn't look at the latest i...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 16 15:34:18 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/7dd1dd742825
changeset: 14528:7dd1dd742825
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 15 18:52:41 2012 +0300
description:
mdbox: mailbox_update() didn't look at the latest index data.
So setting min_next_uid, min_first_recent_uid or min_highest_modseq may have
actually shrank them.

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-storage.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 3a095892242b -r 7dd1dd742825 src/lib-storage/index/dbox-multi/mdbox-storage.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.c	Mon May 14 21:07:43 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c	Tue May 15 18:52:41 2012 +0300
@@ -249,6 +249,7 @@
 {
 	struct mdbox_mailbox *mbox = (struct mdbox_mailbox *)box;
 	struct mail_index_transaction *new_trans = NULL;
+	struct mail_index_view *view;
 	const struct mail_index_header *hdr;
 	uint32_t uid_validity, uid_next;
 
@@ -260,7 +261,8 @@
 		trans = new_trans;
 	}
 
-	hdr = mail_index_get_header(box->view);
+	view = mail_index_view_open(box->index);
+	hdr = mail_index_get_header(view);
 	uid_validity = hdr->uid_validity;
 	if (update != NULL && update->uid_validity != 0)
 		uid_validity = update->uid_validity;
@@ -293,12 +295,12 @@
 			&first_recent_uid, sizeof(first_recent_uid), FALSE);
 	}
 	if (update != NULL && update->min_highest_modseq != 0 &&
-	    mail_index_modseq_get_highest(box->view) <
-	    					update->min_highest_modseq) {
+	    mail_index_modseq_get_highest(view) < update->min_highest_modseq) {
 		mail_index_modseq_enable(box->index);
 		mail_index_update_highest_modseq(trans,
 						 update->min_highest_modseq);
 	}
+	mail_index_view_close(&view);
 
 	mdbox_update_header(mbox, trans, update);
 	if (new_trans != NULL) {


More information about the dovecot-cvs mailing list