dovecot-2.0: mbox: Fixed header-md5/GUID lookup when it's done w...

dovecot at dovecot.org dovecot at dovecot.org
Mon Feb 22 17:04:43 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/d825d532db87
changeset: 10803:d825d532db87
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Feb 22 17:04:40 2010 +0200
description:
mbox: Fixed header-md5/GUID lookup when it's done with mbox file unlocked.

diffstat:

 src/lib-storage/index/mbox/mbox-mail.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r 676ba1a630e1 -r d825d532db87 src/lib-storage/index/mbox/mbox-mail.c
--- a/src/lib-storage/index/mbox/mbox-mail.c	Mon Feb 22 16:58:12 2010 +0200
+++ b/src/lib-storage/index/mbox/mbox-mail.c	Mon Feb 22 17:04:40 2010 +0200
@@ -192,15 +192,19 @@
 		/* 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)) {


More information about the dovecot-cvs mailing list