Mercurial > dovecot > core-2.2
changeset 22136:451a5717d78a
imapc: Fix potential crash if initial sync fails.
Happened at least if mailbox had 0 mails and a failing mailbox_sync() was
called twice.
Fixes:
Panic: file imapc-sync.c: line 477 (imapc_sync_index): assertion failed: (mbox->sync_fetch_first_uid == 1)
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 08 Jun 2017 11:35:58 +0300 |
parents | 6feb39dacf28 |
children | d02fc7312081 |
files | src/lib-storage/index/imapc/imapc-sync.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-sync.c Mon Jun 05 14:21:23 2017 +0300 +++ b/src/lib-storage/index/imapc/imapc-sync.c Thu Jun 08 11:35:58 2017 +0300 @@ -483,7 +483,6 @@ adding new messages requires sync locking to avoid duplicates. */ imapc_sync_send_commands(ctx, mbox->sync_fetch_first_uid); - mbox->sync_fetch_first_uid = 0; } imapc_sync_expunge_finish(ctx); @@ -500,6 +499,10 @@ if (mbox->box.v.sync_notify != NULL) mbox->box.v.sync_notify(&mbox->box, 0, 0); + if (!ctx->failed) { + /* reset only after a successful sync */ + mbox->sync_fetch_first_uid = 0; + } if (!mbox->initial_sync_done && !ctx->failed) { imapc_initial_sync_check(ctx, FALSE); mbox->initial_sync_done = TRUE;