]> 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 13:50:16 +0000 (15:50 +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 d3176853739f213933379c0129bc5d970d0fee41..e711bc0d138a90b434f8b7c730a2b651ae4bcb87 100644 (file)
@@ -1746,7 +1746,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;
@@ -1755,7 +1755,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;
@@ -1774,7 +1774,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) {