changeset 3295:98923db29e39 HEAD

If we're updating only log_file_ext_offset but log file sequence has changed, update log_file_int_offset also to beginning of next file. Fixes assert in mail_transaction_log_view_set().
author Timo Sirainen <tss@iki.fi>
date Sun, 17 Apr 2005 00:41:22 +0300
parents 4600e247da86
children c2b8904dc21b
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Sat Apr 16 22:44:09 2005 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Sun Apr 17 00:41:22 2005 +0300
@@ -8,6 +8,7 @@
 #include "mail-index-view-private.h"
 #include "mail-index-sync-private.h"
 #include "mail-transaction-log.h"
+#include "mail-transaction-log-private.h"
 #include "mail-transaction-util.h"
 
 void mail_index_sync_replace_map(struct mail_index_sync_map_ctx *ctx,
@@ -668,9 +669,16 @@
 
 	mail_transaction_log_get_head(index->log, &seq, &offset);
 
-	map->hdr.log_file_seq = seq;
 	if (!sync_only_external)
 		map->hdr.log_file_int_offset = offset;
+	else if (map->hdr.log_file_seq != seq) {
+		/* log sequence changed. update internal offset to
+		   beginning of the new file. */
+		i_assert(map->hdr.log_file_int_offset ==
+			 index->log->head->hdr.prev_file_offset);
+		map->hdr.log_file_int_offset = index->log->head->hdr.hdr_size;
+	}
+	map->hdr.log_file_seq = seq;
 	map->hdr.log_file_ext_offset = offset;
 
 	if (first_append_uid != 0)