From d9a95e03d9f328065ea3c3c28d522ed196f4a0e7 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 20 Jan 2022 14:16:51 +0100 Subject: [PATCH] doveadm-server: Fix hang when flushing print output and client disconnects --- src/doveadm/doveadm-print-server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doveadm/doveadm-print-server.c b/src/doveadm/doveadm-print-server.c index ec3c7ed524..86688231fd 100644 --- a/src/doveadm/doveadm-print-server.c +++ b/src/doveadm/doveadm-print-server.c @@ -88,7 +88,8 @@ static void doveadm_print_server_flush(void) str_data(ctx.str), str_len(ctx.str)); str_truncate(ctx.str, 0); - if (o_stream_get_buffer_used_size(doveadm_print_ostream) < IO_BLOCK_SIZE) + if (o_stream_get_buffer_used_size(doveadm_print_ostream) < IO_BLOCK_SIZE || + doveadm_print_ostream->stream_errno != 0) return; /* Wait until buffer is flushed to avoid it growing too large */ struct ioloop *prev_loop = current_ioloop; -- 2.47.3