]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Fixed header-md5/GUID lookup when it's done with mbox file unlocked.
authorTimo Sirainen <tss@iki.fi>
Mon, 22 Feb 2010 15:04:40 +0000 (17:04 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 22 Feb 2010 15:04:40 +0000 (17:04 +0200)
--HG--
branch : HEAD

src/lib-storage/index/mbox/mbox-mail.c

index e4cfdb2e06837a56f32d93b194c401f7ceee284e..b760e90d1a6dc30983414466bd9a995f62d90ed1 100644 (file)
@@ -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)) {