Fix a logic bug in kqueue.c.

Remove an unnecessary workaround for OS X 10.4 from kqueue.c. It was causing
problems on macOS Sierra.

All credit for this CL goes to mark@chromium.org.

BUG=626534, 620259

Review-Url: https://codereview.chromium.org/2134603002
Cr-Commit-Position: refs/heads/master@{#404421}
diff --git a/base/third_party/libevent/README.chromium b/base/third_party/libevent/README.chromium
index 4bc235d4..1462e88 100644
--- a/base/third_party/libevent/README.chromium
+++ b/base/third_party/libevent/README.chromium
@@ -35,3 +35,5 @@
    which is missing in the newlib-based PNaCl toolchain.
 7) Stub out signal.c for nacl_helper_nonsfi. socketpair() will be prohibited
    by sandbox in nacl_helper_nonsfi.
+8) Remove an unnecessary workaround for OS X 10.4 from kqueue.c. It was causing
+   problems on macOS Sierra.
diff --git a/base/third_party/libevent/kqueue.c b/base/third_party/libevent/kqueue.c
index ee740ee..3c2ffd5 100644
--- a/base/third_party/libevent/kqueue.c
+++ b/base/third_party/libevent/kqueue.c
@@ -140,28 +140,6 @@
 		TAILQ_INIT(&kqueueop->evsigevents[i]);
 	}
 
-	/* Check for Mac OS X kqueue bug. */
-	memset(&kqueueop->changes[0], 0, sizeof kqueueop->changes[0]);
-	kqueueop->changes[0].ident = -1;
-	kqueueop->changes[0].filter = EVFILT_READ;
-	kqueueop->changes[0].flags = EV_ADD;
-	/* 
-	 * If kqueue works, then kevent will succeed, and it will
-	 * stick an error in events[0].  If kqueue is broken, then
-	 * kevent will fail.
-	 */
-	if (kevent(kq,
-		kqueueop->changes, 1, kqueueop->events, NEVENT, NULL) != 1 ||
-	    kqueueop->events[0].ident != -1 ||
-	    kqueueop->events[0].flags != EV_ERROR) {
-		event_warn("%s: detected broken kqueue; not using.", __func__);
-		free(kqueueop->changes);
-		free(kqueueop->events);
-		free(kqueueop);
-		close(kq);
-		return (NULL);
-	}
-
 	return (kqueueop);
 }