[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-mail.c, 1.1, 1.2

cras at dovecot.org cras at dovecot.org
Thu Jan 5 03:23:30 EET 2006


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

Modified Files:
	dbox-mail.c 
Log Message:
Handle moved mails properly



Index: dbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-mail.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dbox-mail.c	27 Nov 2005 23:05:29 -0000	1.1
+++ dbox-mail.c	5 Jan 2006 01:23:28 -0000	1.2
@@ -80,8 +80,8 @@
 {
 	struct dbox_mailbox *mbox = (struct dbox_mailbox *)mail->ibox;
 	uint32_t seq = mail->mail.mail.seq;
-	uint32_t file_seq;
-	uoff_t offset;
+	uint32_t file_seq, prev_file_seq = 0;
+	uoff_t offset, prev_offset = 0;
 	int i, ret;
 
 	if (mail->mail.mail.expunged)
@@ -104,15 +104,21 @@
 			return dbox_mail_parse_mail_header(mail, mbox->file);
 		}
 
+		if (prev_file_seq == file_seq && prev_offset == offset) {
+			/* broken offset */
+			break;
+		}
+
 		/* mail was moved. resync index file to find out the new offset
 		   and try again. */
 		if (mail_index_refresh(mbox->ibox.index) < 0) {
 			mail_storage_set_index_error(&mbox->ibox);
 			return -1;
 		}
+		prev_file_seq = file_seq;
+		prev_offset = offset;
 	}
 
-	/* FIXME: index just might not be updated yet.. */
 	mail_storage_set_critical(STORAGE(mbox->storage),
 				  "Cached message offset lost for seq %u in "
 				  "dbox file %s", seq, mbox->path);



More information about the dovecot-cvs mailing list