aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>2020-05-28 12:43:05 +0900
committerCorinna Vinschen <corinna@vinschen.de>2020-05-28 09:25:49 +0200
commit25987b2c2a49013ce6d8c9d2ab29a92eb05f9482 (patch)
tree24cfd8b627673b0e2fafaf4c79a2630028cb1f24
parent50d7dcaa0bd535a2a70e076a0ca0d15c1c1e8e01 (diff)
downloadnewlib-25987b2c2a49013ce6d8c9d2ab29a92eb05f9482.zip
newlib-25987b2c2a49013ce6d8c9d2ab29a92eb05f9482.tar.gz
newlib-25987b2c2a49013ce6d8c9d2ab29a92eb05f9482.tar.bz2
Cygwin: pty: Fix a bug in free_attached_console().
- After commit 7659ff0f5afd751f42485f2684c799c5f37b0fb9, nohup does not work as expected. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin-developers/2020-May/011885.html
-rw-r--r--winsup/cygwin/fhandler_tty.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index df08dd2..f29a2c2 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -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;