From c50acc5547b9d92784825a09e3de97db0a806f4e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 5 Oct 2017 20:24:11 +0300 Subject: [PATCH] lib: istream-multiplex - Minor code cleanup Avoid propagating the error twice, and avoid any confusion about what "got" actually contains. --- src/lib/istream-multiplex.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/istream-multiplex.c b/src/lib/istream-multiplex.c index 9060d9b28b..a52de43312 100644 --- a/src/lib/istream-multiplex.c +++ b/src/lib/istream-multiplex.c @@ -94,8 +94,11 @@ i_stream_multiplex_read(struct multiplex_istream *mstream, uint8_t cid) 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; } -- 2.47.3