]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Fixed assert-crashing on failures with read-only mboxes
authorTimo Sirainen <tss@iki.fi>
Mon, 26 Jul 2010 18:21:47 +0000 (19:21 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 26 Jul 2010 18:21:47 +0000 (19:21 +0100)
src/lib-storage/index/mbox/mbox-sync.c

index 2c26de9149a8bd55c1c8dc3bb5eae83a1e8a5353..88aff6c602f53b2ccf08ddc38b353270e01eb389 100644 (file)
@@ -1592,8 +1592,9 @@ static int mbox_sync_do(struct mbox_sync_context *sync_ctx,
                if (sync_ctx->delay_writes &&
                    (sync_ctx->errors || sync_ctx->renumber_uids)) {
                        /* fixing a broken mbox state, be sure to write
-                          the changes. */
-                       sync_ctx->delay_writes = FALSE;
+                          the changes (except if we're readonly). */
+                       if (!sync_ctx->readonly)
+                               sync_ctx->delay_writes = FALSE;
                }
                if (++i == 3)
                        break;
@@ -1791,6 +1792,7 @@ again:
                        if (mbox_lock(mbox, F_RDLCK, lock_id) <= 0)
                                return -1;
                        mbox->box.backend_readonly = readonly = TRUE;
+                       delay_writes = TRUE;
                }
        }