diff options
author | cjihrig <cjihrig@gmail.com> | 2018-06-21 00:02:03 +0300 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-06-22 17:41:31 +0300 |
commit | 49ea06fda5840091fa936454ef1079f6560be74a (patch) | |
tree | 135dcc47d13cb3a4357f682a88e15e714197c94d /src/tcp_wrap.cc | |
parent | d9e95d8982ee5b409b36f09c77feccbb1040095c (diff) |
net: report uv_tcp_open() errors
uv_tcp_open() can fail. Prior to this commit, any error was
being silently ignored. This commit raises the errors.
PR-URL: https://github.com/nodejs/node/pull/21428
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/tcp_wrap.cc')
-rw-r--r-- | src/tcp_wrap.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 01c7d253e66..28a970a2264 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -211,8 +211,12 @@ void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) { args.Holder(), args.GetReturnValue().Set(UV_EBADF)); int fd = static_cast<int>(args[0]->IntegerValue()); - uv_tcp_open(&wrap->handle_, fd); - wrap->set_fd(fd); + int err = uv_tcp_open(&wrap->handle_, fd); + + if (err == 0) + wrap->set_fd(fd); + + args.GetReturnValue().Set(err); } |