aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2024-02-13 11:17:46 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2024-02-13 23:36:05 +0900
commita6ac7b413891b9fa4fce58bb1fb4729798b7c8a1 (patch)
treead9e34bbf7be5163cb1675c99a47d4ec6c24894f /winsup
parent70371d610dde24b4ee8459912f6bfa48eef4b096 (diff)
downloadnewlib-a6ac7b413891b9fa4fce58bb1fb4729798b7c8a1.zip
newlib-a6ac7b413891b9fa4fce58bb1fb4729798b7c8a1.tar.gz
newlib-a6ac7b413891b9fa4fce58bb1fb4729798b7c8a1.tar.bz2
Cygwin: pty: Fix handle leak in master process.
If non-cygwin process is started in pty, closing from_master_nat pipe handle was missing in fhandler_pty_slave::input_transfer(). This occured because the handle was duplicated but not closed. https://github.com/msys2/msys2-runtime/issues/198 Fixes: 29431fcb5b14 ("Cygwin: pty: Inherit typeahead data between two input pipes.") Reported-by: Hakkin Lain Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/fhandler/pty.cc1
-rw-r--r--winsup/cygwin/release/3.5.14
2 files changed, 5 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index 3f4bc56..c5c7921 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -3995,6 +3995,7 @@ fhandler_pty_slave::transfer_input (tty::xfer_dir dir, HANDLE from, tty *ttyp,
transfered = true;;
}
}
+ CloseHandle (to);
/* Fix input_available_event which indicates availability in cyg pipe. */
if (dir == tty::to_nat) /* all data is transfered to nat pipe,
diff --git a/winsup/cygwin/release/3.5.1 b/winsup/cygwin/release/3.5.1
index 81945db..715fcf7 100644
--- a/winsup/cygwin/release/3.5.1
+++ b/winsup/cygwin/release/3.5.1
@@ -12,3 +12,7 @@ Fixes:
error mode is now possible by using the new CYGWIN environment variable
option "winjitdebug".
Addresses: https://cygwin.com/pipermail/cygwin/2024-February/255305.html
+
+- Fix handle leak in pty master which occurs when non-cygwin process
+ is started in pty.
+ Addresses: https://github.com/msys2/msys2-runtime/issues/198