diff --git a/src/unix/stream.c b/src/unix/stream.c index 4ce324074..ff420db23 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1188,19 +1188,20 @@ int uv_write2(uv_write_t* req, int empty_queue; assert(bufcnt > 0); - - assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || - stream->type == UV_TTY) && - "uv_write (unix) does not yet support other types of streams"); + assert((stream->type == UV_TCP || + stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY) && + "uv_write (unix) does not yet support other types of streams"); if (uv__stream_fd(stream) < 0) - return uv__set_sys_error(stream->loop, EBADF); + return uv__set_artificial_error(stream->loop, UV_EBADF); if (send_handle) { if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) - return uv__set_sys_error(stream->loop, EOPNOTSUPP); + return uv__set_artificial_error(stream->loop, UV_EINVAL); + if (uv__stream_fd(send_handle) < 0) - return uv__set_sys_error(stream->loop, EBADF); + return uv__set_artificial_error(stream->loop, UV_EBADF); } empty_queue = (stream->write_queue_size == 0);