changeset 13240:68c7faa869f8

mbox: Fixed crashing with pop3_lock_session=yes
author Timo Sirainen <tss@iki.fi>
date Mon, 15 Aug 2011 00:30:18 +0300
parents 5aee3be80d10
children e2379af31de1
files src/lib-storage/index/mbox/mbox-lock.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-lock.c	Sun Aug 14 23:39:10 2011 +0300
+++ b/src/lib-storage/index/mbox/mbox-lock.c	Mon Aug 15 00:30:18 2011 +0300
@@ -784,8 +784,10 @@
 	i_assert(lock_type == F_RDLCK || lock_type == F_WRLCK);
 	i_assert(lock_type == F_RDLCK || mbox->mbox_lock_type != F_RDLCK);
 
-	/* mbox must be locked before index */
-	i_assert(mbox->box.index->lock_type != F_WRLCK);
+	/* mbox must be locked before index (the NULL check is for
+	   MAILBOX_FLAG_KEEP_LOCKED) */
+	i_assert(mbox->box.index == NULL ||
+		 mbox->box.index->lock_type != F_WRLCK);
 
 	if (mbox->mbox_lock_type == F_UNLCK) {
 		ret = mbox_update_locking(mbox, lock_type, &fcntl_locked);