changeset 20480:4909fa3325e8

LAYOUT=index: Make sure error is preserved if created mailbox can't be added to list index. mailbox_delete() could overwrite the error.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 01 Jul 2016 16:27:30 +0300
parents 0fd0da4a3cfb
children 94736fed1324
files src/lib-storage/list/mailbox-list-index-backend.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index-backend.c	Fri Jul 01 11:56:46 2016 +0300
+++ b/src/lib-storage/list/mailbox-list-index-backend.c	Fri Jul 01 16:27:30 2016 +0300
@@ -374,8 +374,14 @@
 			if (ret <= 0) {
 				/* failed to add to list. rollback the backend
 				   mailbox creation */
+				bool create_error = ret < 0;
+
+				if (create_error)
+					mail_storage_last_error_push(box->storage);
 				if (mailbox_delete(box) < 0)
 					ret = -1;
+				if (create_error)
+					mail_storage_last_error_pop(box->storage);
 			}
 		}
 		list->create_mailbox_name = old_name;