Mercurial > dovecot > core-2.2
changeset 20804:5332b9d8315c
lib-storage: If mailbox_move() fails, reset mail_save_context.moving==FALSE
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 29 Sep 2016 14:00:49 +0300 |
parents | 0bddf1154654 |
children | 073625e2d619 |
files | src/lib-storage/mail-storage.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c Tue Sep 27 15:50:11 2016 +0300 +++ b/src/lib-storage/mail-storage.c Thu Sep 29 14:00:49 2016 +0300 @@ -2233,14 +2233,15 @@ int mailbox_move(struct mail_save_context **_ctx, struct mail *mail) { struct mail_save_context *ctx = *_ctx; + int ret; + + i_assert(!ctx->moving); ctx->moving = TRUE; - if (mailbox_copy(_ctx, mail) < 0) - return -1; - - mail_expunge(mail); + if ((ret = mailbox_copy(_ctx, mail)) == 0) + mail_expunge(mail); ctx->moving = FALSE; - return 0; + return ret; } int mailbox_save_using_mail(struct mail_save_context **ctx, struct mail *mail)