Skip to content

Commit

Permalink
src: handle errors from uv_pipe_connect2()
Browse files Browse the repository at this point in the history
We need to handle errors from uv_pipe_connect2()
because return type is `int`.

Fixes: #50652
Refs: #49667
Refs: libuv/libuv#4030
PR-URL: #50657
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
  • Loading branch information
deokjinkim authored and UlisesGascon committed Dec 11, 2023
1 parent 4d28ced commit c253e39
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/pipe_wrap.cc
Expand Up @@ -225,16 +225,19 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {

ConnectWrap* req_wrap =
new ConnectWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPECONNECTWRAP);
req_wrap->Dispatch(
int err = req_wrap->Dispatch(
uv_pipe_connect2, &wrap->handle_, *name, name.length(), 0, AfterConnect);
if (err) {
delete req_wrap;
} else {
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native),
"connect",
req_wrap,
"pipe_path",
TRACE_STR_COPY(*name));
}

TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native),
"connect",
req_wrap,
"pipe_path",
TRACE_STR_COPY(*name));

args.GetReturnValue().Set(0); // uv_pipe_connect() doesn't return errors.
args.GetReturnValue().Set(err);
}

} // namespace node
Expand Down

0 comments on commit c253e39

Please sign in to comment.