From: Stephan Bosch Date: Tue, 23 Jan 2018 20:24:35 +0000 (+0100) Subject: lib-program-client: Restructure reading input from program to simplify handling of... X-Git-Tag: 2.3.9~2421 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9b6d24bfa1354757fe9bc68205c0323e40abce3;p=thirdparty%2Fdovecot%2Fcore.git lib-program-client: Restructure reading input from program to simplify handling of dot input stream. --- diff --git a/src/lib-program-client/program-client.c b/src/lib-program-client/program-client.c index 5221c1d4cb..d4acc85251 100644 --- a/src/lib-program-client/program-client.c +++ b/src/lib-program-client/program-client.c @@ -315,13 +315,6 @@ void program_client_program_input(struct program_client *pclient) } if (pclient->dot_input != NULL) input = pclient->dot_input; - else if (pclient->set.use_dotstream) { - /* just read it empty */ - while(i_stream_read_more(input, &data, - &size) > 0) - i_stream_skip(input, size); - output = NULL; - } if (output != NULL) { res = o_stream_send_istream(output, input); switch (res) { @@ -350,21 +343,19 @@ void program_client_program_input(struct program_client *pclient) PROGRAM_CLIENT_ERROR_IO); return; } - } else { - while ((ret=i_stream_read_more(input, &data, &size)) > 0) - i_stream_skip(input, size); - - if (ret == 0) + } + while ((ret=i_stream_read_more(input, &data, &size)) > 0) + i_stream_skip(input, size); + if (ret == 0) + return; + if (ret < 0) { + if (input->stream_errno != 0) { + i_error("read(%s) failed: %s", + i_stream_get_name(input), + i_stream_get_error(input)); + program_client_fail(pclient, + PROGRAM_CLIENT_ERROR_IO); return; - if (ret < 0) { - if (input->stream_errno != 0) { - i_error("read(%s) failed: %s", - i_stream_get_name(input), - i_stream_get_error(input)); - program_client_fail(pclient, - PROGRAM_CLIENT_ERROR_IO); - return; - } } } if (program_client_input_pending(pclient))