From 2400716d875a6481c13fd0b46068ab3b6afa5345 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Tue, 23 Apr 2013 22:34:43 -0400 Subject: [PATCH] stream: fix osx select hack After latest twiddling, `stream->io_watcher.fd` doesn't contain a real stream's file descriptior anymore. The one from `select_state` should be used instead. Zero-initialize `select_state->event` field. --- src/unix/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/unix/stream.c b/src/unix/stream.c index bc9d4f1b..c0a7ddde 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -139,7 +139,7 @@ static void uv__stream_osx_select(void* arg) { stream = arg; s = stream->select; - fd = stream->io_watcher.fd; + fd = s->fd; if (fd > s->int_fd) max_fd = fd; @@ -305,6 +305,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) { if (s == NULL) return uv__set_artificial_error(stream->loop, UV_ENOMEM); + s->events = 0; s->fd = *fd; if (uv_async_init(stream->loop, &s->async, uv__stream_osx_select_cb)) {