]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Make sure mailbox_sync*() fails if view is inconsistent afterwards.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 27 Sep 2016 16:39:59 +0000 (19:39 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 13 Oct 2016 08:20:50 +0000 (10:20 +0200)
src/lib-storage/index/index-sync.c

index 8b47937ae5edb5a3a3e197bb6493b8627d17021b..cbec04594f28b8503a956e0711f78eee0ef9a216 100644 (file)
@@ -345,6 +345,15 @@ int index_mailbox_sync_deinit(struct mailbox_sync_context *_ctx,
        /* update vsize header if wanted */
        index_mailbox_vsize_update_appends(_ctx->box);
 
+       if (ret == 0 && mail_index_view_is_inconsistent(_ctx->box->view)) {
+               /* we probably had MAILBOX_SYNC_FLAG_FIX_INCONSISTENT set,
+                  but the view got broken in the middle. FIXME: We could
+                  attempt to fix it automatically. In any case now the view
+                  isn't usable and we can't return success. */
+               mailbox_set_index_error(_ctx->box);
+               ret = -1;
+       }
+
        index_mailbox_sync_free(ctx);
        return ret;
 }