Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2020-07-15 22:44:10 +0300
committerRobert Nagy <ronagy@icloud.com>2021-07-02 23:11:16 +0300
commit954217adda03457115e426e9126dcad845877f74 (patch)
tree5f278968722de533049e71296c9e0859e5dcc2c2 /src/tty_wrap.cc
parent1544e69b93565c97e7ed232bf2db237d34b8fd7c (diff)
stream: error Duplex write/read if not writable/readable
If writable/readable has been explicitly disabled then using a Duplex as writable/readable should fail. Fixes: https://github.com/nodejs/node/issues/34374 PR-URL: https://github.com/nodejs/node/pull/34385 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/tty_wrap.cc')
-rw-r--r--src/tty_wrap.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index 401c2513dbc..e9c7eb37a66 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -121,9 +121,9 @@ void TTYWrap::New(const FunctionCallbackInfo<Value>& args) {
CHECK_GE(fd, 0);
int err = 0;
- new TTYWrap(env, args.This(), fd, args[1]->IsTrue(), &err);
+ new TTYWrap(env, args.This(), fd, &err);
if (err != 0) {
- env->CollectUVExceptionInfo(args[2], err, "uv_tty_init");
+ env->CollectUVExceptionInfo(args[1], err, "uv_tty_init");
args.GetReturnValue().SetUndefined();
}
}
@@ -132,13 +132,12 @@ void TTYWrap::New(const FunctionCallbackInfo<Value>& args) {
TTYWrap::TTYWrap(Environment* env,
Local<Object> object,
int fd,
- bool readable,
int* init_err)
: LibuvStreamWrap(env,
object,
reinterpret_cast<uv_stream_t*>(&handle_),
AsyncWrap::PROVIDER_TTYWRAP) {
- *init_err = uv_tty_init(env->event_loop(), &handle_, fd, readable);
+ *init_err = uv_tty_init(env->event_loop(), &handle_, fd, 0);
set_fd(fd);
if (*init_err != 0)
MarkAsUninitialized();