[PATCH] Cygwin: pty: Fix input transferring from nat pipe to cyg pipe
Takashi Yano
takashi.yano@nifty.ne.jp
Tue Mar 3 13:40:47 GMT 2026
In disable_pcon mode, input transferring from nat pipe to cyg pipe
does not work after the commit 04f386e9af99. This is because nat
pipe hand over is wrongly handled in get_winpid_to_hand_over().
This function should return the PID that should acquire ownership
of the nat pipe. However, when pseudo console is disabled, it
returns PID of cygwin process (such as cygwin shell) when no
other native (non-cygwin) app is not found.
The case that even cygwin app should take over the ownership
of nat pipe, is happen only in pcon_activated case. This patch
adds pcon_activated check to the condition where even a cygwin
app is allowable as a target to hand over.
Fixes: 04f386e9af99 ("Cygwin: console: Inherit pcon hand over from parent pty")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by:
---
winsup/cygwin/fhandler/pty.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index 3e8c7ff9f..03f31d1fe 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -3596,7 +3596,7 @@ fhandler_pty_slave::get_winpid_to_hand_over (tty *ttyp,
if (!switch_to)
switch_to = get_console_process_id (current_pid,
false, true, false, true);
- if (!switch_to)
+ if (!switch_to && ttyp->pcon_activated)
switch_to = get_console_process_id (current_pid,
false, false, false, false);
}
--
2.51.0
More information about the Cygwin-patches
mailing list