changeset 22759:a83edde46a15

imapc: If mailbox select fails, rollback any changes done to it 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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 25 Dec 2017 19:34:31 +0200
parents ca2de1a90858
children 4b4bddfa51cb
files src/lib-storage/index/imapc/imapc-mailbox.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Mon Dec 25 19:33:33 2017 +0200
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Mon Dec 25 19:34:31 2017 +0200
@@ -100,7 +100,12 @@
 
 	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;