diff --git a/src/unix/pipe.c b/src/unix/pipe.c index f3bd35dd03f..c3b6ee2a443 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -129,14 +129,14 @@ int uv_pipe_link(uv_pipe_t *read, uv_pipe_t *write) { uv__nonblock(fds[1], 1); } - err = uv__stream_open((uv_stream_t*)read, fds[0], 0); + err = uv__stream_open((uv_stream_t*)read, fds[0], UV_STREAM_READABLE); if (err) { close(fds[0]); close(fds[1]); goto pipe_error; } - err = uv__stream_open((uv_stream_t*)write, fds[1], 0); + err = uv__stream_open((uv_stream_t*)write, fds[1], UV_STREAM_WRITABLE); if (err) { uv_pipe_close_sync(read); close(fds[0]); diff --git a/src/unix/stream.c b/src/unix/stream.c index bef67497751..3e09b0e9856 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1209,10 +1209,10 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { * have to do anything. If the partial read flag is not set, we can't * report the EOF yet because there is still data to read. */ - if ((events & UV__POLLHUP) && - (stream->flags & UV_STREAM_READING) && + if ((events & UV__POLLHUP) && ((events == UV__POLLHUP) || + ((stream->flags & UV_STREAM_READING) && (stream->flags & UV_STREAM_READ_PARTIAL) && - !(stream->flags & UV_STREAM_READ_EOF)) { + !(stream->flags & UV_STREAM_READ_EOF)))) { uv_buf_t buf = { NULL, 0 }; uv__stream_eof(stream, &buf); }