]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mailbox_rename() - Use source storage for errors
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 9 Jan 2018 20:33:26 +0000 (15:33 -0500)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 8 Feb 2018 10:08:43 +0000 (12:08 +0200)
It was documented to use source storage for errors, but some of the errors
were set to destination storage.

src/lib-storage/mail-storage.c

index 35fe340651abfc42c1d3da9939174fed650b2121..4cab375e11270bce3d42806942b0776f41d0e827 100644 (file)
@@ -1747,7 +1747,7 @@ int mailbox_rename_check_children(struct mailbox *src, struct mailbox *dest)
                        continue; /* not our child */
                /* if total length of new name exceeds the limit, fail */
                if (strlen(child->vname + src_prefix_len)+dest_prefix_len > MAILBOX_LIST_NAME_MAX_LENGTH) {
-                       mail_storage_set_error(dest->storage, MAIL_ERROR_PARAMS,
+                       mail_storage_set_error(src->storage, MAIL_ERROR_PARAMS,
                                "Mailbox or child name too long");
                        ret = -1;
                        break;
@@ -1756,7 +1756,7 @@ int mailbox_rename_check_children(struct mailbox *src, struct mailbox *dest)
 
        /* something went bad */
        if (mailbox_list_iter_deinit(&iter) < 0) {
-               mail_storage_copy_list_error(dest->storage, src->list);
+               mail_storage_copy_list_error(src->storage, src->list);
                ret = -1;
        }
        return ret;
@@ -1775,7 +1775,7 @@ int mailbox_rename(struct mailbox *src, struct mailbox *dest)
                return -1;
        }
        if (mailbox_verify_create_name(dest) < 0) {
-               mail_storage_copy_error(dest->storage, src->storage);
+               mail_storage_copy_error(src->storage, dest->storage);
                return -1;
        }
        if (mailbox_rename_check_children(src, dest) != 0) {