]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: If mail_index_sync_begin() fails, don't assert-crash
authorTimo Sirainen <tss@iki.fi>
Thu, 30 Sep 2010 15:05:57 +0000 (16:05 +0100)
committerTimo Sirainen <tss@iki.fi>
Thu, 30 Sep 2010 15:05:57 +0000 (16:05 +0100)
src/lib-index/mail-index-sync.c

index c8939f38b2e03715b080f7c15a84988826f630af..6eafe5fc1b4a65fad281b8ecbb8957cbcdef47bd 100644 (file)
@@ -456,6 +456,9 @@ int mail_index_sync_begin_to(struct mail_index *index,
                                        MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL);
        mail_index_view_close(&sync_view);
 
+       /* set before any rollbacks are called */
+       index->syncing = TRUE;
+
        /* we wish to see all the changes from last mailbox sync position to
           the end of the transaction log */
        if (mail_index_sync_set_log_view(ctx->view, hdr->log_file_seq,
@@ -488,8 +491,6 @@ int mail_index_sync_begin_to(struct mail_index *index,
        ctx->ext_trans = mail_index_transaction_begin(ctx->view, trans_flags);
        ctx->ext_trans->sync_transaction = TRUE;
 
-       index->syncing = TRUE;
-
        *ctx_r = ctx;
        *view_r = ctx->view;
        *trans_r = ctx->ext_trans;