Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler/pty.cc')
-rw-r--r--winsup/cygwin/fhandler/pty.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index 607333f52..3f4bc56b5 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -85,7 +85,8 @@ inline static bool process_alive (DWORD pid);
stub_only: return only stub process's pid of non-cygwin process. */
DWORD
fhandler_pty_common::get_console_process_id (DWORD pid, bool match,
- bool cygwin, bool stub_only)
+ bool cygwin, bool stub_only,
+ bool nat)
{
tmp_pathbuf tp;
DWORD *list = (DWORD *) tp.c_get ();
@@ -109,6 +110,8 @@ fhandler_pty_common::get_console_process_id (DWORD pid, bool match,
else
{
pinfo p (cygwin_pid (list[i]));
+ if (nat && !!p && !ISSTATE(p, PID_NOTCYGWIN))
+ continue;
if (!!p && p->exec_dwProcessId)
{
res_pri = stub_only ? p->exec_dwProcessId : list[i];
@@ -3511,9 +3514,11 @@ fhandler_pty_slave::get_winpid_to_hand_over (tty *ttyp,
{
/* Search another native process which attaches to the same console */
DWORD current_pid = myself->exec_dwProcessId ?: myself->dwProcessId;
- switch_to = get_console_process_id (current_pid, false, true, true);
+ switch_to = get_console_process_id (current_pid,
+ false, true, true, true);
if (!switch_to)
- switch_to = get_console_process_id (current_pid, false, true, false);
+ switch_to = get_console_process_id (current_pid,
+ false, true, false, true);
}
return switch_to;
}