From 74882a259a97e56d906ad34b29604c4e25aa9a2b Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 23 Oct 2010 18:55:01 +0000 Subject: * pinfo.cc (pinfo::exit): Reset tty pgrp to zero if no more handles open. (_pinfo::set_ctty): Remove debugging stuff. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/pinfo.cc | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 599d26fc3..56e3b67c4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2010-10-23 Christopher Faylor + + * pinfo.cc (pinfo::exit): Reset tty pgrp to zero if no more handles open. + (_pinfo::set_ctty): Remove debugging stuff. + 2010-10-23 Christopher Faylor * fhandler_tty.cc (fhandler_pty_master::open): Remove debugging printf. diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index c2709ead1..d45e0a3cf 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -186,6 +186,12 @@ pinfo::exit (DWORD n) } sigproc_terminate (ES_FINAL); + if (myself->ctty >= 0 && myself->ctty != TTY_CONSOLE) + { + tty *t = cygwin_shared->tty[myself->ctty]; + if (!t->slave_alive ()) + t->setpgid (0); + } /* FIXME: There is a potential race between an execed process and its parent here. I hated to add a mutex just for that, though. */ @@ -390,9 +396,7 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch) else sid = tc->getsid (); if (tc->getpgid () == 0) -{debug_printf ("setting pgid to %d", pgid); tc->setpgid (pgid); -} if (cygheap->ctty != arch) { debug_printf ("cygheap->ctty %p, arch %p", cygheap->ctty, arch); -- cgit v1.2.3