changeset 21417:cb8d45426709

doveadm: Outgoing dsync TCP connections leaked socket If doveadm-server was running with service_count>1, each dsync run leaked a socket.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 17 Jan 2017 16:23:50 +0200
parents d99859db19de
children 31c324df23f0
files src/doveadm/doveadm-dsync.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/doveadm-dsync.c	Tue Jan 17 19:21:08 2017 +0200
+++ b/src/doveadm/doveadm-dsync.c	Tue Jan 17 16:23:50 2017 +0200
@@ -493,6 +493,9 @@
 		ctx->input = i_stream_create_fd(ctx->fd_in, (size_t)-1, FALSE);
 		ctx->output = o_stream_create_fd(ctx->fd_out, (size_t)-1, FALSE);
 	} else {
+		i_assert(ctx->fd_in == -1 && ctx->fd_out == -1);
+		ctx->fd_in = i_stream_get_fd(ctx->input);
+		ctx->fd_out = o_stream_get_fd(ctx->output);
 		ctx->input_orig_bufsize = i_stream_get_max_buffer_size(ctx->input);
 		ctx->output_orig_bufsize = o_stream_get_max_buffer_size(ctx->output);
 		i_stream_set_max_buffer_size(ctx->input, (size_t)-1);