From 1f9bb887812cde28fb91025d9b7c7c7ca46b4f7f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 3 Dec 2018 15:43:06 +0200 Subject: [PATCH] maildir: Don't crash with zlib plugin when saving is aborted The ostream can be finished even if the saving had already failed. It gets deleted anyway. Fixes: Panic: file ostream-zlib.c: line 37 (o_stream_zlib_close): assertion failed: (zstream->ostream.finished || zstream->ostream.ostream.stream_errno != 0 || zstream->ostream.error_handling_disabled) --- src/lib-storage/index/maildir/maildir-save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib-storage/index/maildir/maildir-save.c b/src/lib-storage/index/maildir/maildir-save.c index 718ac39bbd..e4e98c30dc 100644 --- a/src/lib-storage/index/maildir/maildir-save.c +++ b/src/lib-storage/index/maildir/maildir-save.c @@ -510,7 +510,7 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx) } path = t_strconcat(ctx->tmpdir, "/", ctx->file_last->tmp_name, NULL); - if (!ctx->failed && o_stream_finish(_ctx->data.output) < 0) { + if (o_stream_finish(_ctx->data.output) < 0) { if (!mail_storage_set_error_from_errno(storage)) { mail_set_critical(_ctx->dest_mail, "write(%s) failed: %s", path, -- 2.47.3