From 3f47a2da5c5b7f13d227fc99b760cc6a949f152a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 21 Feb 2013 09:56:33 +0100 Subject: [PATCH] unix: fail early on bad send_handle in uv_write2 Return UV_EBADF if send_handle doesn't have a valid fd. --- src/unix/stream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unix/stream.c b/src/unix/stream.c index 00e451c5..30199f17 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1203,6 +1203,8 @@ int uv_write2(uv_write_t* req, uv__set_sys_error(stream->loop, EOPNOTSUPP); return -1; } + if (uv__stream_fd(send_handle) < 0) + return uv__set_sys_error(stream->loop, EBADF); } empty_queue = (stream->write_queue_size == 0);