From: Timo Sirainen Date: Tue, 27 Sep 2016 16:39:59 +0000 (+0300) Subject: lib-storage: Make sure mailbox_sync*() fails if view is inconsistent afterwards. X-Git-Tag: 2.3.0.rc1~2958 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d33fd7fc78aae43175330c66636332de615c69f;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Make sure mailbox_sync*() fails if view is inconsistent afterwards. --- diff --git a/src/lib-storage/index/index-sync.c b/src/lib-storage/index/index-sync.c index 8ce070d8cf..9c631175fb 100644 --- a/src/lib-storage/index/index-sync.c +++ b/src/lib-storage/index/index-sync.c @@ -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; }