]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-multiplex - Minor code cleanup
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 5 Oct 2017 17:24:11 +0000 (20:24 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 5 Oct 2017 17:24:11 +0000 (20:24 +0300)
Avoid propagating the error twice, and avoid any confusion about what "got"
actually contains.

src/lib/istream-multiplex.c

index 9060d9b28b7872721b25965926b96bdef6c6ad4d..a52de43312f14e0bfaac9e642ee27b3556b9e781 100644 (file)
@@ -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;
                }