[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync.c, 1.96, 1.97

cras at dovecot.org cras at dovecot.org
Tue Oct 5 03:50:31 EEST 2004


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

Modified Files:
	mbox-sync.c 
Log Message:
Don't loop forever if sync record UIDs don't exist anymore.



Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- mbox-sync.c	5 Oct 2004 00:26:40 -0000	1.96
+++ mbox-sync.c	5 Oct 2004 00:50:28 -0000	1.97
@@ -705,6 +705,7 @@
 mbox_sync_seek_to_uid(struct mbox_sync_context *sync_ctx, uint32_t uid)
 {
 	uint32_t seq1, seq2;
+	uoff_t file_size;
 
 	if (mail_index_lookup_uid_range(sync_ctx->sync_view, uid, (uint32_t)-1,
 					&seq1, &seq2) < 0) {
@@ -712,6 +713,19 @@
 		return -1;
 	}
 
+	if (seq1 == 0) {
+		/* doesn't exist anymore, seek to end of file */
+		file_size = i_stream_get_size(sync_ctx->ibox->mbox_file_stream);
+		if (istream_raw_mbox_seek(sync_ctx->ibox->mbox_stream,
+					  file_size) < 0) {
+			mail_storage_set_critical(sync_ctx->ibox->box.storage,
+				"Error seeking to end of mbox file %s",
+				sync_ctx->ibox->path);
+			return -1;
+		}
+		return 1;
+	}
+
 	return mbox_sync_seek_to_seq(sync_ctx, seq1);
 }
 



More information about the dovecot-cvs mailing list