]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-program-client: Restructure reading input from program to simplify handling of...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 23 Jan 2018 20:24:35 +0000 (21:24 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 26 Jan 2018 19:17:11 +0000 (20:17 +0100)
src/lib-program-client/program-client.c

index 5221c1d4cb7a447d7412923a6acde0492acaba8f..d4acc85251b9fd66442c0198e93ca641e7524cc1 100644 (file)
@@ -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))