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.
This commit is contained in:
Ben Noordhuis 2013-03-05 15:57:38 +01:00
parent ea0796f3bf
commit 0b26af376a

View File

@ -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);