Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2688:606c79327434 HEAD
Don't loop forever if sync record UIDs don't exist anymore.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 05 Oct 2004 03:50:28 +0300 |
parents | 482e1a1fe2ce |
children | 631611c2d6e6 |
files | src/lib-storage/index/mbox/mbox-sync.c |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync.c Tue Oct 05 03:26:40 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync.c Tue Oct 05 03:50:28 2004 +0300 @@ -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); }