Cygwin: pty: Fix a bug in free_attached_console().

- After commit 7659ff0f5a, nohup does
  not work as expected. This patch fixes the issue.

  Addresses:
  https://cygwin.com/pipermail/cygwin-developers/2020-May/011885.html
This commit is contained in:
Takashi Yano via Cygwin-patches 2020-05-28 12:43:05 +09:00 committed by Corinna Vinschen
parent 50d7dcaa0b
commit 25987b2c2a
1 changed files with 4 additions and 1 deletions

View File

@ -188,7 +188,10 @@ set_ishybrid_and_switch_to_pcon (HANDLE h)
inline void
fhandler_pty_slave::free_attached_console ()
{
if (freeconsole_on_close && get_minor () == pcon_attached_to)
bool attached = get_ttyp () ?
fhandler_console::get_console_process_id (get_helper_process_id (), true)
: (get_minor () == pcon_attached_to);
if (freeconsole_on_close && attached)
{
FreeConsole ();
pcon_attached_to = -1;