Mercurial > dovecot > core-2.2
changeset 20817:75519fa6f6a5
lib-storage: Make sure mailbox_sync*() fails if view is inconsistent afterwards.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 27 Sep 2016 19:39:59 +0300 |
parents | 877fb5725b00 |
children | 139b1e3beb85 |
files | src/lib-storage/index/index-sync.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-sync.c Tue Sep 27 19:38:26 2016 +0300 +++ b/src/lib-storage/index/index-sync.c Tue Sep 27 19:39:59 2016 +0300 @@ -345,6 +345,15 @@ /* 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; }