浏览代码

io_wait: fix kqueue io_wait_add & POLLIN

A "goto error" was placed outside the error handling "if",
resulting in any io_watch_add(), that tried to enable write
watching on a new FD, returning failure (fortunately this kind
of io_watch_add() usage doesn't happen very often, usually write
watch is enabled via io_watch_chg() on FDs already
io_watch_add()'ed for reading).

Only POLL_KQUEUE was affected by this bug, meaning the default on
all *bsd and darwin.
Andrei Pelinescu-Onciul 15 年之前
父节点
当前提交
e5be1a0671
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      io_wait.h

+ 2 - 2
io_wait.h

@@ -499,7 +499,7 @@ again2:
 		case POLL_KQUEUE:
 			if (likely( events & POLLIN)){
 				if (unlikely(kq_ev_change(h, fd, EVFILT_READ, EV_ADD, e)==-1))
-				goto error;
+					goto error;
 			}
 			if (unlikely( events & POLLOUT)){
 				if (unlikely(kq_ev_change(h, fd, EVFILT_WRITE, EV_ADD, e)==-1))
@@ -507,8 +507,8 @@ again2:
 					if (likely(events & POLLIN)){
 						kq_ev_change(h, fd, EVFILT_READ, EV_DELETE, 0);
 					}
+					goto error;
 				}
-				goto error;
 			}
 			break;
 #endif