changeset 7144:0734af67ca99 HEAD

Fixed index reopen check to work more correctly when syncing view/head.
author Timo Sirainen <tss@iki.fi>
date Fri, 11 Jan 2008 04:42:37 +0200
parents 81d7093fb892
children 5187649faa52
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Fri Jan 11 04:41:30 2008 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Fri Jan 11 04:42:37 2008 +0200
@@ -692,6 +692,8 @@
 		return 0;
 	}
 
+	start_offset = type == MAIL_INDEX_SYNC_HANDLER_FILE ?
+		map->hdr.log_file_tail_offset : map->hdr.log_file_head_offset;
 	if (!force && !index->mmap_disable) {
 		/* see if we'd prefer to reopen the index file instead of
 		   syncing the current map from the transaction log.
@@ -713,13 +715,11 @@
 		/* this isn't necessary correct currently, but it should be
 		   close enough */
 		log_size = index->log->head->last_size;
-		if (log_size > map->hdr.log_file_tail_offset &&
-		    log_size - map->hdr.log_file_tail_offset > index_size)
+		if (log_size > start_offset &&
+		    log_size - start_offset > index_size)
 			return 0;
 	}
 
-	start_offset = type == MAIL_INDEX_SYNC_HANDLER_FILE ?
-		map->hdr.log_file_tail_offset : map->hdr.log_file_head_offset;
 	view = mail_index_view_open_with_map(index, map);
 	ret = mail_transaction_log_view_set(view->log_view,
 					    map->hdr.log_file_seq, start_offset,