소스 검색

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.

(cherry picked from commit e5be1a067158c8ba49d33082eb403937546e7c69)
Andrei Pelinescu-Onciul 15 년 전
부모
커밋
8e6609c441
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      io_wait.h

+ 2 - 2
io_wait.h

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