]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Avoid assert-crashing by too optimistically upgrading a lock to write-lock.
authorTimo Sirainen <tss@iki.fi>
Mon, 24 Jun 2013 20:10:20 +0000 (23:10 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 24 Jun 2013 20:10:20 +0000 (23:10 +0300)
src/lib-storage/index/mbox/mbox-lock.c

index 33e15395791856efde295cce39f350b3422f6e42..086817afea034322aa014d786e17526dc6d5ab6d 100644 (file)
@@ -784,7 +784,8 @@ int mbox_lock(struct mbox_mailbox *mbox, int lock_type,
        bool fcntl_locked;
        int ret;
 
-       if (lock_type == F_RDLCK && mbox->external_transactions > 0) {
+       if (lock_type == F_RDLCK && mbox->external_transactions > 0 &&
+           mbox->mbox_lock_type != F_RDLCK) {
                /* we have a transaction open that is going to save mails
                   and apparently also wants to read from the same mailbox
                   (copy, move, catenate). we need to write lock the mailbox,