]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
ioloop-select: IO_ERROR wasn't really working.
authorTimo Sirainen <tss@iki.fi>
Sat, 13 Mar 2010 13:25:44 +0000 (15:25 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 13 Mar 2010 13:25:44 +0000 (15:25 +0200)
--HG--
branch : HEAD

src/lib/ioloop-select.c

index 468faeeb1bee724d0e6131c1798fe414fa0f1aec..a480f130fbfbcacbdcd99664339de29e6c3c2205 100644 (file)
@@ -65,9 +65,9 @@ void io_loop_handle_add(struct io_file *io)
        if (fd >= FD_SETSIZE)
                i_fatal("fd %d too large for select()", fd);
 
-        if (condition & IO_READ)
+        if ((condition & (IO_READ | IO_ERROR)) != 0)
                FD_SET(fd, &ctx->read_fds);
-        if (condition & IO_WRITE)
+        if ((condition & IO_WRITE) != 0)
                FD_SET(fd, &ctx->write_fds);
        FD_SET(fd, &ctx->except_fds);
 
@@ -83,9 +83,9 @@ void io_loop_handle_remove(struct io_file *io, bool closed ATTR_UNUSED)
 
        i_assert(fd >= 0 && fd < FD_SETSIZE);
 
-        if (condition & IO_READ)
+       if ((condition & (IO_READ | IO_ERROR)) != 0)
                FD_CLR(fd, &ctx->read_fds);
-        if (condition & IO_WRITE)
+        if ((condition & IO_WRITE) != 0)
                FD_CLR(fd, &ctx->write_fds);
 
        if (!FD_ISSET(fd, &ctx->read_fds) && !FD_ISSET(fd, &ctx->write_fds)) {
@@ -99,7 +99,7 @@ void io_loop_handle_remove(struct io_file *io, bool closed ATTR_UNUSED)
 }
 
 #define io_check_condition(ctx, fd, cond) \
-       ((FD_ISSET((fd), &(ctx)->tmp_read_fds) && ((cond) & IO_READ)) || \
+       ((FD_ISSET((fd), &(ctx)->tmp_read_fds) && ((cond) & (IO_READ|IO_ERROR))) || \
         (FD_ISSET((fd), &(ctx)->tmp_write_fds) && ((cond) & IO_WRITE)) || \
         (FD_ISSET((fd), &(ctx)->tmp_except_fds)))