From: Timo Sirainen Date: Sun, 20 May 2018 22:42:27 +0000 (+0300) Subject: lib: Fix ioloop-poll and ioloop-select to work with io_add_istream() X-Git-Tag: 2.3.9~1830 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8699605749984a0a38c8454bb420381983f1974f;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix ioloop-poll and ioloop-select to work with io_add_istream() --- diff --git a/src/lib/ioloop-poll.c b/src/lib/ioloop-poll.c index 660d8fe063..b140c6f54d 100644 --- a/src/lib/ioloop-poll.c +++ b/src/lib/ioloop-poll.c @@ -177,6 +177,10 @@ void io_loop_handler_run_internal(struct ioloop *ioloop) for (; io != NULL && ret > 0; io = ioloop->next_io_file) { ioloop->next_io_file = io->next; + if (io->fd == -1) { + /* io_add_istream() without fd */ + continue; + } pollfd = &ctx->fds[ctx->fd_index[io->fd]]; if (pollfd->revents != 0) { if (pollfd->revents & POLLNVAL) { diff --git a/src/lib/ioloop-select.c b/src/lib/ioloop-select.c index 8c335520df..cee011f41c 100644 --- a/src/lib/ioloop-select.c +++ b/src/lib/ioloop-select.c @@ -134,7 +134,9 @@ void io_loop_handler_run_internal(struct ioloop *ioloop) for (; io != NULL && ret > 0; io = ioloop->next_io_file) { ioloop->next_io_file = io->next; - if (io_check_condition(ctx, io->fd, io->io.condition)) { + if (io->fd == -1) { + /* io_add_istream() without fd */ + } else if (io_check_condition(ctx, io->fd, io->io.condition)) { ret--; io_loop_call_io(&io->io); }