]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: COPY allows transaction commit now to fail with "some messages were expunged".
authorTimo Sirainen <tss@iki.fi>
Mon, 21 Oct 2013 17:47:53 +0000 (20:47 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 21 Oct 2013 17:47:53 +0000 (20:47 +0300)
src/imap/cmd-copy.c

index 57619f56b12ce9088db7762acc77b20f902357fe..e066752a5911792413fc586839e86a69b7ecddd7 100644 (file)
@@ -127,9 +127,15 @@ static bool cmd_copy_full(struct client_command_context *cmd, bool move)
        msg = t_str_new(256);
        if (ret <= 0)
                mailbox_transaction_rollback(&t);
-       else if (mailbox_transaction_commit_get_changes(&t, &changes) < 0)
-               ret = -1;
-       else if (copy_count == 0) {
+       else if (mailbox_transaction_commit_get_changes(&t, &changes) < 0) {
+               if (mailbox_get_last_mail_error(destbox) == MAIL_ERROR_EXPUNGED) {
+                       /* storage backend didn't notice the expunge until
+                          at commit time. */
+                       ret = 0;
+               } else {
+                       ret = -1;
+               }
+       } else if (copy_count == 0) {
                str_append(msg, "OK No messages found.");
                pool_unref(&changes.pool);
        } else if (seq_range_count(&changes.saved_uids) == 0 ||