public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon.
@ 2021-03-08 13:14 Takashi Yano
  2021-03-08 14:03 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2021-03-08 13:14 UTC (permalink / raw)
  To: cygwin-patches

- If two non-cygwin apps are started simultaneously, attaching to
  pseudo console sometimes fails. This is because the second app
  trys to attach to the process not started yet. This patch avoids
  the issue by attaching to the stub process rather than the other
  non-cygwin app.
---
 winsup/cygwin/fhandler_tty.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 4358bceec..3bfc8c0c8 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -3104,7 +3104,7 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon)
 		       0, TRUE, DUPLICATE_SAME_ACCESS);
       CloseHandle (pcon_owner);
       FreeConsole ();
-      AttachConsole (p->dwProcessId);
+      AttachConsole (p->exec_dwProcessId);
       goto skip_create;
     }
 
-- 
2.30.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon.
  2021-03-08 13:14 [PATCH] Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon Takashi Yano
@ 2021-03-08 14:03 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2021-03-08 14:03 UTC (permalink / raw)
  To: cygwin-patches

On Mar  8 22:14, Takashi Yano via Cygwin-patches wrote:
> - If two non-cygwin apps are started simultaneously, attaching to
>   pseudo console sometimes fails. This is because the second app
>   trys to attach to the process not started yet. This patch avoids
>   the issue by attaching to the stub process rather than the other
>   non-cygwin app.
> ---
>  winsup/cygwin/fhandler_tty.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index 4358bceec..3bfc8c0c8 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -3104,7 +3104,7 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon)
>  		       0, TRUE, DUPLICATE_SAME_ACCESS);
>        CloseHandle (pcon_owner);
>        FreeConsole ();
> -      AttachConsole (p->dwProcessId);
> +      AttachConsole (p->exec_dwProcessId);
>        goto skip_create;
>      }
>  
> -- 
> 2.30.1

Pushed.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-08 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 13:14 [PATCH] Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon Takashi Yano
2021-03-08 14:03 ` 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).