]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 9 Feb 2018 14:09:41 +0000 (16:09 +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 b450485bbf34b06515a6dc0b6e49d6f35e3e9ad3..6f441c21104fb825a112f5a8e02243bf2433c32b 100644 (file)
@@ -1669,7 +1669,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;
@@ -1678,7 +1678,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;
@@ -1697,7 +1697,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) {