]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix ioloop-poll and ioloop-select to work with io_add_istream()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 20 May 2018 22:42:27 +0000 (01:42 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 21 May 2018 09:05:00 +0000 (09:05 +0000)
src/lib/ioloop-poll.c
src/lib/ioloop-select.c

index 660d8fe06371bdbe995f898f6fe8e96671fb4b50..b140c6f54d2eb0259b747db5237e5e59c67ab9f7 100644 (file)
@@ -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) {
index 8c335520dfe7ca57ccea81d9db7f2a22fe300537..cee011f41cbca7c2359cb3c4c1712dd57c5206a3 100644 (file)
@@ -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);
                }