darwin: handle EINTR in /dev/tty workaround

On OS X, special files like /dev/null and /dev/tty don't work with
kqueue.  Libuv falls back to select() in that case but the initial
probe didn't handle EINTR.

Introduced in August 2012 in commit 731adaca ("unix: use select()
for specific fds on OS X"), this bug was only ten days away from
celebrating its fourth birthday.

PR-URL: https://github.com/libuv/libuv/pull/979
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Ben Noordhuis 2016-08-06 06:19:41 +02:00
parent 7b07d18ad9
commit 39ee4121a1

View File

@ -291,7 +291,10 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
timeout.tv_sec = 0;
timeout.tv_nsec = 1;
ret = kevent(kq, filter, 1, events, 1, &timeout);
do
ret = kevent(kq, filter, 1, events, 1, &timeout);
while (ret == -1 && errno == EINTR);
uv__close(kq);
if (ret == -1)