This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH 1/1] Cygwin: pty: Fix potential state mismatch regarding pseudo console.
- From: Takashi Yano <takashi dot yano at nifty dot ne dot jp>
- To: cygwin-patches at cygwin dot com
- Cc: Takashi Yano <takashi dot yano at nifty dot ne dot jp>
- Date: Thu, 5 Sep 2019 19:44:41 +0900
- Subject: [PATCH 1/1] Cygwin: pty: Fix potential state mismatch regarding pseudo console.
- Dkim-filter: OpenDKIM Filter v2.10.3 conuserg-05.nifty.com x85AiitW031038
- References: <20190905104441.2075-1-takashi.yano@nifty.ne.jp>
- PTY with pseudo console support sitll has problem which potentially
cause state mismatch between state variable and real console state.
This patch fixes this issue.
---
winsup/cygwin/dtable.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 4e9b6ed56..7b2e52005 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -159,14 +159,19 @@ dtable::stdio_init ()
{
bool attached = !!fhandler_console::get_console_process_id
(ptys->getHelperProcessId (), true);
- if (!attached)
+ if (attached)
+ break;
+ else
{
/* Not attached to pseudo console in fork() or spawn()
by some reason. This happens if the executable is
a windows GUI binary, such as mintty. */
FreeConsole ();
if (AttachConsole (ptys->getHelperProcessId ()))
- break;
+ {
+ ptys->fixup_after_attach (false);
+ break;
+ }
}
}
}
--
2.21.0