Prevent infinite loop, when kevent(2) is called wihout eventlist (i.e.

eventlist == NULL or nevents == 0).
This commit is contained in:
sobomax 2001-12-08 00:53:37 +00:00
parent ba1e7b8577
commit c1953cedc9

View File

@ -49,7 +49,7 @@ _kevent(int kq, const struct kevent *changelist, int nchanges,
rc = __sys_kevent(kq, changelist, nchanges,
eventlist, nevents, &nullts);
if (rc == 0 && (timeout == NULL ||
if (rc == 0 && eventlist != NULL && nevents > 0 && (timeout == NULL ||
timeout->tv_sec != 0 || timeout->tv_nsec != 0)) {
/* Save the socket file descriptor: */
curthread->data.fd.fd = kq;