dovecot-1.0: One more UIDVALIDITY=0 fix

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 12 04:10:46 EEST 2007


details:   http://hg.dovecot.org/dovecot-1.0/rev/b6753fd66298
changeset: 5341:b6753fd66298
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 12 04:10:42 2007 +0300
description:
One more UIDVALIDITY=0 fix

diffstat:

1 file changed, 9 insertions(+), 2 deletions(-)
src/lib-storage/index/maildir/maildir-uidlist.c |   11 +++++++++--

diffs (28 lines):

diff -r c1d0acf68614 -r b6753fd66298 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Wed Jul 11 01:41:51 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Thu Jul 12 04:10:42 2007 +0300
@@ -658,6 +658,15 @@ static int maildir_uidlist_rewrite(struc
 	i_assert(uidlist->lock_count ==
 		 1 + (uidlist->mbox->ibox.keep_locked ? 1 : 0));
 
+	if (uidlist->uid_validity == 0) {
+		/* saving a message to a newly created maildir. */
+		const struct mail_index_header *hdr;
+
+		hdr = mail_index_get_header(uidlist->mbox->ibox.view);
+		uidlist->uid_validity = hdr->uid_validity != 0 ?
+			hdr->uid_validity : ioloop_time;
+	}
+
 	temp_path = t_strconcat(mbox->control_dir,
 				"/" MAILDIR_UIDLIST_NAME ".lock", NULL);
 	ret = maildir_uidlist_rewrite_fd(uidlist, temp_path);
@@ -976,8 +985,6 @@ int maildir_uidlist_sync_deinit(struct m
 	bool unlocked = FALSE;
 	int ret = ctx->failed ? -1 : 0;
 
-	i_assert(ctx->uidlist->uid_validity != 0);
-
 	*_ctx = NULL;
 
 	if (!ctx->finished)


More information about the dovecot-cvs mailing list