dovecot: One more UIDVALIDITY=0 fix

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 12 04:56:20 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/5513182aed67
changeset: 5959:5513182aed67
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 12 04:55:20 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 5825961b9862 -r 5513182aed67 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Thu Jul 12 04:24:22 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Thu Jul 12 04:55:20 2007 +0300
@@ -967,6 +967,15 @@ static int maildir_uidlist_sync_update(s
 	struct maildir_uidlist *uidlist = ctx->uidlist;
 	uoff_t file_size;
 
+	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;
+	}
+
 	if (ctx->uidlist->recreate || uidlist->fd == -1 ||
 	    uidlist->version != 3 ||
 	    (uidlist->read_records_count + ctx->new_files_count) *
@@ -1289,8 +1298,6 @@ int maildir_uidlist_sync_deinit(struct m
 	struct maildir_uidlist_sync_ctx *ctx = *_ctx;
 	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