[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync.c, 1.181.2.7, 1.181.2.8

tss at dovecot.org tss at dovecot.org
Mon Jan 22 12:11:10 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv442

Modified Files:
      Tag: branch_1_0
	mbox-sync.c 
Log Message:
If mbox had broken UIDs and we didn't rewrite them, don't mark the index as
being synced.



Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.181.2.7
retrieving revision 1.181.2.8
diff -u -d -r1.181.2.7 -r1.181.2.8
--- mbox-sync.c	12 Nov 2006 21:30:27 -0000	1.181.2.7
+++ mbox-sync.c	22 Jan 2007 12:11:08 -0000	1.181.2.8
@@ -1022,7 +1022,7 @@
 	uint32_t uid, messages_count;
 	uoff_t offset;
 	int ret;
-	bool expunged, skipped_mails;
+	bool expunged, skipped_mails, uids_broken;
 
 	messages_count =
 		mail_index_view_get_messages_count(sync_ctx->sync_view);
@@ -1033,7 +1033,7 @@
 	if (ret <= 0)
 		return ret;
 
-	skipped_mails = FALSE;
+	skipped_mails = uids_broken = FALSE;
 	while ((ret = mbox_sync_read_next_mail(sync_ctx, mail_ctx)) > 0) {
 		uid = mail_ctx->mail.uid;
 
@@ -1067,6 +1067,8 @@
 			sync_ctx->mbox->mbox_sync_dirty = TRUE;
 			return 0;
 		}
+		if (mail_ctx->mail.uid_broken)
+			uids_broken = TRUE;
 
 		if (mail_ctx->pseudo)
 			uid = 0;
@@ -1191,6 +1193,13 @@
 
 	if (!skipped_mails)
 		sync_ctx->mbox->mbox_sync_dirty = FALSE;
+
+	if (uids_broken && sync_ctx->delay_writes) {
+		/* once we get around to writing the changes, we'll need to do
+		   a full sync to avoid the "UIDs broken in partial sync"
+		   error */
+		sync_ctx->mbox->mbox_sync_dirty = TRUE;
+	}
 	return 1;
 }
 



More information about the dovecot-cvs mailing list