public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pty: Fix potential state mismatch regarding pseudo console.
@ 2019-09-05 12:09 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-09-05 12:09 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b7e429420063264d0be7ee6804f3e6f143f66232

commit b7e429420063264d0be7ee6804f3e6f143f66232
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Thu Sep 5 19:44:41 2019 +0900

    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.

Diff:
---
 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 4e9b6ed..7b2e520 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;
+		    }
 		}
 	    }
 	}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-05 12:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 12:09 [newlib-cygwin] Cygwin: pty: Fix potential state mismatch regarding pseudo console Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).