diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-04-11 04:54:44 +0300 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-04-11 04:54:44 +0300 |
commit | 8b9e3ac4080bf34f7b0a6122741ff2f8db810522 (patch) | |
tree | ea83dc5219ff5c920bab02aae8af014c429a1f65 | |
parent | 7ed6d0249f1f06bb42b13587598fbbb30cf81a82 (diff) |
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.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 36992324d..c91f40044 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -2122,7 +2122,7 @@ fhandler_pty_common::resize_pseudo_console (struct winsize *ws) OpenProcess (PROCESS_DUP_HANDLE, FALSE, get_ttyp ()->pcon_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 (); @@ -3600,15 +3600,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); |