From: Timo Sirainen Date: Mon, 22 Feb 2010 15:04:40 +0000 (+0200) Subject: mbox: Fixed header-md5/GUID lookup when it's done with mbox file unlocked. X-Git-Tag: 2.0.beta4~165 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cbcde6379f1b0b27bdefc4b11eec93ad69e459d4;p=thirdparty%2Fdovecot%2Fcore.git mbox: Fixed header-md5/GUID lookup when it's done with mbox file unlocked. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/mbox/mbox-mail.c b/src/lib-storage/index/mbox/mbox-mail.c index e4cfdb2e06..b760e90d1a 100644 --- a/src/lib-storage/index/mbox/mbox-mail.c +++ b/src/lib-storage/index/mbox/mbox-mail.c @@ -192,15 +192,19 @@ mbox_mail_get_special(struct mail *_mail, enum mail_fetch_field field, /* i guess in theory the empty_md5 is valid and can happen, but it's almost guaranteed that it means the MD5 sum is missing. recalculate it. */ - offset = istream_raw_mbox_get_start_offset(mbox->mbox_stream); + offset = mbox->mbox_lock_type == F_UNLCK ? 0 : + istream_raw_mbox_get_start_offset(mbox->mbox_stream); mbox->mbox_save_md5 = TRUE; if (mbox_sync(mbox, MBOX_SYNC_FORCE_SYNC | MBOX_SYNC_READONLY) < 0) return -1; - if (istream_raw_mbox_seek(mbox->mbox_stream, offset) < 0) { - i_error("mbox %s sync lost during MD5 syncing", - _mail->box->name); - return -1; + if (mbox->mbox_lock_type != F_UNLCK) { + if (istream_raw_mbox_seek(mbox->mbox_stream, + offset) < 0) { + i_error("mbox %s sync lost during MD5 syncing", + _mail->box->name); + return -1; + } } if (!mbox_mail_get_md5_header(mail, value_r)) {