]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: If mailbox select fails, rollback any changes done to it
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 25 Dec 2017 17:34:31 +0000 (19:34 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 18 Jan 2018 07:12:31 +0000 (09:12 +0200)
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.

src/lib-storage/index/imapc/imapc-mailbox.c

index 72053db3de82d97aa66538aaf9022c381dcf0d85..5ef82783d86b8f0fbe72f6c5e87c005b206cc5e8 100644 (file)
@@ -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;