Browse Source

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 years ago
parent
commit
e5be1a0671
1 changed files with 2 additions and 2 deletions
  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