Cygwin: pty: Fix failure to clear switch_to_nat_pipe flag.
After the commitfbfea31dd9
, switch_to_nat_pipe is not cleared properly when non-cygwin app is terminated in the case where the pseudo console is disabled. This is because get_winpid_to_hand_over() sometimes returns PID of cygwin process even though it should return only PID of non-cygwin process. This patch fixes the issue by adding a new argument which requests only PID of non-cygwin process to get_console_process_id(). Fixes:fbfea31dd9
("Cygwin: pty: Avoid cutting the branch the pty master is sitting on.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
parent
7ba103eb1a
commit
90d3b16d2b
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -2399,7 +2399,8 @@ class fhandler_pty_common: public fhandler_termios
|
|||
void resize_pseudo_console (struct winsize *);
|
||||
static DWORD get_console_process_id (DWORD pid, bool match,
|
||||
bool cygwin = false,
|
||||
bool stub_only = false);
|
||||
bool stub_only = false,
|
||||
bool nat = false);
|
||||
bool to_be_read_from_nat_pipe (void);
|
||||
static DWORD attach_console_temporarily (DWORD target_pid);
|
||||
static void resume_from_temporarily_attach (DWORD resume_pid);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Bug Fixes
|
||||
---------
|
||||
|
||||
- Fix a bug introduced in cygwin 3.4.0 that switch_to_nat_pipe flag is
|
||||
not cleared properly when non-cygwin app is terminated in the case
|
||||
where pseudo console is not activated.
|
Loading…
Reference in New Issue