Skip to content

Commit

Permalink
imapc: If mailbox select fails, rollback any changes done to it
Browse files Browse the repository at this point in the history
Required by the following changes that start adding changes immediately
after SELECT. If the initial syncing doesn't finish successfully, these
changes need to be reverted.
  • Loading branch information
sirainen authored and villesavolainen committed Jan 18, 2018
1 parent ce651ec commit 33b25be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -100,7 +100,12 @@ int imapc_mailbox_commit_delayed_trans(struct imapc_mailbox *mbox,

if (mbox->delayed_sync_view != NULL)
mail_index_view_close(&mbox->delayed_sync_view);
if (mbox->delayed_sync_trans != NULL) {
if (mbox->delayed_sync_trans == NULL)
;
else if (!mbox->selected) {
/* ignore any changes done during SELECT */
mail_index_transaction_rollback(&mbox->delayed_sync_trans);
} else {
if (mail_index_transaction_commit(&mbox->delayed_sync_trans) < 0) {
mailbox_set_index_error(&mbox->box);
ret = -1;
Expand Down

0 comments on commit 33b25be

Please sign in to comment.