diff src/lib/istream-multiplex.c @ 22576:707ae9de3812

lib: istream-multiplex - Minor code cleanup Avoid propagating the error twice, and avoid any confusion about what "got" actually contains.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 05 Oct 2017 20:24:11 +0300
parents 7db517071db5
children 51b74dbe1ce9
line wrap: on
line diff
--- a/src/lib/istream-multiplex.c	Thu Oct 05 12:34:10 2017 +0300
+++ b/src/lib/istream-multiplex.c	Thu Oct 05 20:24:11 2017 +0300
@@ -94,8 +94,11 @@
 	for(;;) {
 		data = i_stream_get_data(mstream->parent, &len);
 		if (len == 0) {
-			if (got == 0 && mstream->blocking)
-				got += i_stream_multiplex_read(mstream, cid);
+			if (got == 0 && mstream->blocking) {
+				/* can't return 0 with blocking istreams,
+				   so try again from the beginning. */
+				return i_stream_multiplex_read(mstream, cid);
+			}
 			break;
 		}