diff options
author | Christopher Faylor <me@cgf.cx> | 2010-09-20 22:28:57 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2010-09-20 22:28:57 +0000 |
commit | df4d2bea3d9446532844b92e3ac38d5472672e6f (patch) | |
tree | 54ba263493d5db5be2247b6d41f8d9e8ad6b9a80 /winsup/cygwin/fhandler_tty.cc | |
parent | 73b6b43ed33037f897ad95651f8ac2d1b233b25b (diff) | |
download | newlib-df4d2bea3d9446532844b92e3ac38d5472672e6f.zip newlib-df4d2bea3d9446532844b92e3ac38d5472672e6f.tar.gz newlib-df4d2bea3d9446532844b92e3ac38d5472672e6f.tar.bz2 |
* include/sys/cygwin.h (PID_NOTCYGWIN): New enum.
* spawn.cc (spawn_guts): Set a flag when a process is not a cygwin process.
* fhandler_tty.cc (fhandler_tty_slave::init): Remove previous change. Try a
different method to determine when we should become the process group owner.
* signal.cc (kill0): Remove archaic code which dealt with never-set flag.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 632e3aa..52b264a 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -711,19 +711,19 @@ fhandler_tty_slave::init (HANDLE f, DWORD a, mode_t) int ret = open (flags); - /* We should only grab this when the parent process owns the pgid - (which could happen when a cygwin process starts a DOS process which - starts a cygwin process or when we are being started directly from a - windows process, e.g., from the CMD prompt. */ - if (ret && !cygwin_finished_initializing && !being_debugged () - && (myself->ppid == 1 || myself->ppid == tc->getpgid ())) + if (ret && !cygwin_finished_initializing && !being_debugged ()) { /* This only occurs when called from dtable::init_std_file_from_handle We have been started from a non-Cygwin process. So we should become tty process group leader. TODO: Investigate how SIGTTIN should be handled with pure-windows programs. */ - tc->setpgid (myself->pgid); + pinfo p (tc->getpgid ()); + /* We should only grab this when the process group owner for this + tty is a non-cygwin process or we've been started directly + from a non-Cygwin process with no Cygwin ancestry. */ + if (!p || ISSTATE (p, PID_NOTCYGWIN)) + tc->setpgid (myself->pgid); } if (f != INVALID_HANDLE_VALUE) |