aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-04-11 10:44:41 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-04-12 01:27:13 +0900
commitb58b5a96601f9e7424e4cb21aa0b9b2915daa49c (patch)
tree2ded2e1ef3610275e4b48aa86cf71294872db3d3
parent27f0913c17c216548b2f5eea79037ee90038f375 (diff)
downloadnewlib-b58b5a96601f9e7424e4cb21aa0b9b2915daa49c.zip
newlib-b58b5a96601f9e7424e4cb21aa0b9b2915daa49c.tar.gz
newlib-b58b5a96601f9e7424e4cb21aa0b9b2915daa49c.tar.bz2
Cygwin: pty: Do not set internal handles in HPCON inheritable.
- The internal handles in HPCON should not be inheritable, however, the current code duplicates them as inheritable when handing over ownership of the pseudo console. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251222.html
-rw-r--r--winsup/cygwin/fhandler_tty.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index c02dfb8..484bf55 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -2056,7 +2056,7 @@ fhandler_pty_common::resize_pseudo_console (struct winsize *ws)
OpenProcess (PROCESS_DUP_HANDLE, FALSE, get_ttyp ()->nat_pipe_owner_pid);
DuplicateHandle (pcon_owner, get_ttyp ()->h_pcon_write_pipe,
GetCurrentProcess (), &hpcon_local.hWritePipe,
- 0, TRUE, DUPLICATE_SAME_ACCESS);
+ 0, FALSE, DUPLICATE_SAME_ACCESS);
acquire_attach_mutex (mutex_timeout);
ResizePseudoConsole ((HPCON) &hpcon_local, size);
release_attach_mutex ();
@@ -3551,15 +3551,15 @@ fhandler_pty_slave::close_pseudoconsole (tty *ttyp, DWORD force_switch_to)
DuplicateHandle (GetCurrentProcess (),
ttyp->h_pcon_write_pipe,
new_owner, &new_write_pipe,
- 0, TRUE, DUPLICATE_SAME_ACCESS);
+ 0, FALSE, DUPLICATE_SAME_ACCESS);
DuplicateHandle (GetCurrentProcess (),
ttyp->h_pcon_condrv_reference,
new_owner, &new_condrv_reference,
- 0, TRUE, DUPLICATE_SAME_ACCESS);
+ 0, FALSE, DUPLICATE_SAME_ACCESS);
DuplicateHandle (GetCurrentProcess (),
ttyp->h_pcon_conhost_process,
new_owner, &new_conhost_process,
- 0, TRUE, DUPLICATE_SAME_ACCESS);
+ 0, FALSE, DUPLICATE_SAME_ACCESS);
DuplicateHandle (GetCurrentProcess (), ttyp->h_pcon_in,
new_owner, &new_pcon_in,
0, TRUE, DUPLICATE_SAME_ACCESS);