]> 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)
committerGitLab <gitlab@git.dovecot.net>
Tue, 4 Oct 2016 20:32:29 +0000 (23:32 +0300)
src/lib-storage/index/index-sync.c

index 8ce070d8cf7b2decb6112d7b58a3bc42794c307e..9c631175fb2c2e4845e9bc663a6490a9e66d50c5 100644 (file)
@@ -346,6 +346,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;
 }