From 0b26af376a8d788adf00ed4cb60aba4da2f046c1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 5 Mar 2013 15:57:38 +0100 Subject: [PATCH] unix: handle POLLERR and POLLHUP in uv__stream_io Fixes a busy loop when the file descriptor emits POLLHUP but not POLLIN or POLLOUT, e.g. when polling the read end of a pipe and the write end is closed. Fixes joyent/node#4923. --- src/unix/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/stream.c b/src/unix/stream.c index 080535e5..8137d24e 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1119,7 +1119,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { return; } - if (events & UV__POLLIN) { + if (events & (UV__POLLIN | UV__POLLERR | UV__POLLHUP)) { assert(uv__stream_fd(stream) >= 0); uv__read(stream);