summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2019-09-05 19:44:41 +0900
committerCorinna Vinschen <corinna@vinschen.de>2019-09-05 13:59:37 +0200
commitb7e429420063264d0be7ee6804f3e6f143f66232 (patch)
treef9b3608da25bdf46f1b0974ea267d9566a0508c1
parent915fcd0ae8d83546ce135131cd25bf6795d97966 (diff)
downloadcygnal-b7e429420063264d0be7ee6804f3e6f143f66232.tar.gz
cygnal-b7e429420063264d0be7ee6804f3e6f143f66232.tar.bz2
cygnal-b7e429420063264d0be7ee6804f3e6f143f66232.zip
Cygwin: pty: Fix potential state mismatch regarding pseudo console.
- 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.
-rw-r--r--winsup/cygwin/dtable.cc9
1 files 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;
+ }
}
}
}