]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
LAYOUT=index: Make sure error is preserved if created mailbox can't be added to list...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 1 Jul 2016 13:27:30 +0000 (16:27 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 1 Jul 2016 14:43:32 +0000 (17:43 +0300)
mailbox_delete() could overwrite the error.

src/lib-storage/list/mailbox-list-index-backend.c

index 4cef1bcf69377a21db3e8e0c47d4f24d43395305..492924d0530a9e46136b384030bce7566a25434c 100644 (file)
@@ -374,8 +374,14 @@ index_list_mailbox_create(struct mailbox *box,
                        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;