]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-server: Fix hang when flushing print output and client disconnects
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 20 Jan 2022 13:16:51 +0000 (14:16 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 25 Jan 2022 18:25:50 +0000 (18:25 +0000)
src/doveadm/doveadm-print-server.c

index ec3c7ed524b50ed03dc15a5c3c6b13282fcf924e..86688231fd6aa7fd7d5691a36dbf3f90b7073282 100644 (file)
@@ -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;