From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id ECB8B3939C04; Mon, 8 Mar 2021 14:02:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECB8B3939C04 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 07e2ce9f55eb2464371816334b603b741f81e22a X-Git-Newrev: 850b5a9aae49a9a0fa21d3ace385e8d6b03ae285 Message-Id: <20210308140254.ECB8B3939C04@sourceware.org> Date: Mon, 8 Mar 2021 14:02:54 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:02:55 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=850b5a9aae49a9a0fa21d3ace385e8d6b03ae285 commit 850b5a9aae49a9a0fa21d3ace385e8d6b03ae285 Author: Takashi Yano via Cygwin-patches Date: Mon Mar 8 22:14:58 2021 +0900 Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon. - 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. Diff: --- 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; }