dovecot: When reading an index file created by v1.0, make sure w...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 16 20:19:51 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/f814eecd75cd
changeset: 6822:f814eecd75cd
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 16 20:19:40 2007 +0200
description:
When reading an index file created by v1.0, make sure we update the header
version and write the main index.

diffstat:

2 files changed, 9 insertions(+), 2 deletions(-)
src/lib-index/mail-index-map.c  |    8 ++++++--
src/lib-index/mail-index-sync.c |    3 +++

diffs (32 lines):

diff -r eebfe0cd2add -r f814eecd75cd src/lib-index/mail-index-map.c
--- a/src/lib-index/mail-index-map.c	Fri Nov 16 20:11:05 2007 +0200
+++ b/src/lib-index/mail-index-map.c	Fri Nov 16 20:19:40 2007 +0200
@@ -441,9 +441,13 @@ int mail_index_map_check_header(struct m
 	if (hdr->seen_messages_count > hdr->messages_count ||
 	    hdr->deleted_messages_count > hdr->messages_count)
 		return 0;
-	if (hdr->first_recent_uid == 0 && hdr->minor_version == 0) {
+	if (hdr->minor_version == 0) {
 		/* upgrade silently from v1.0 */
-		map->hdr.first_recent_uid = 1;
+		map->hdr.minor_version = MAIL_INDEX_MINOR_VERSION;
+		map->hdr.unused_old_recent_messages_count = 0;
+		if (hdr->first_recent_uid == 0)
+			map->hdr.first_recent_uid = 1;
+		index->need_recreate = TRUE;
 	}
 	if (hdr->first_recent_uid == 0 ||
 	    hdr->first_recent_uid > hdr->next_uid ||
diff -r eebfe0cd2add -r f814eecd75cd src/lib-index/mail-index-sync.c
--- a/src/lib-index/mail-index-sync.c	Fri Nov 16 20:11:05 2007 +0200
+++ b/src/lib-index/mail-index-sync.c	Fri Nov 16 20:19:40 2007 +0200
@@ -278,6 +278,9 @@ mail_index_need_sync(struct mail_index *
 	    hdr->log_file_seq < log_file_seq)
 		return TRUE;
 
+	if (index->need_recreate)
+		return TRUE;
+
 	/* already synced */
 	return mail_cache_need_compress(index->cache);
 }


More information about the dovecot-cvs mailing list