[dovecot-cvs] dovecot/src/lib-index mail-index-view-sync.c, 1.52.2.5, 1.52.2.6

tss at dovecot.org tss at dovecot.org
Wed Jan 17 18:47:45 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv32258

Modified Files:
      Tag: branch_1_0
	mail-index-view-sync.c 
Log Message:
unreliable_flags wasn't always set correctly, which caused "xxx counter
wrong" errors and such.



Index: mail-index-view-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.52.2.5
retrieving revision 1.52.2.6
diff -u -d -r1.52.2.5 -r1.52.2.6
--- mail-index-view-sync.c	14 Jan 2007 04:01:27 -0000	1.52.2.5
+++ mail-index-view-sync.c	17 Jan 2007 18:47:43 -0000	1.52.2.6
@@ -268,16 +268,22 @@
 		uint32_t old_records_count = view->map->records_count;
 
 		if (view->map != view->index->map) {
+			const struct mail_index_header *hdr;
+
 			/* Using non-head mapping. We have to apply
 			   transactions to it to get latest changes into it. */
 			ctx->sync_map_update = TRUE;
+
 			/* Unless map was synced at the exact same position as
 			   view, the message flags can't be reliably used to
-			   update flag counters. */
+			   update flag counters. note that map->hdr may contain
+			   old information if another process updated the
+			   index file since. */
+			hdr = view->map->mmap_base != NULL ?
+				view->map->mmap_base : &view->map->hdr;
 			ctx->sync_map_ctx.unreliable_flags =
-				!(view->map->hdr.log_file_seq ==
-				  view->log_file_seq &&
-				  view->map->hdr.log_file_int_offset ==
+				!(hdr->log_file_seq == view->log_file_seq &&
+				  hdr->log_file_int_offset ==
 				  view->log_file_offset);
 
 			/* Copy only the mails that we see currently, since



More information about the dovecot-cvs mailing list