Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-09-21 00:25:50 +0400
committerChristopher Faylor <me@cgf.cx>2010-09-21 00:25:50 +0400
commit73b6b43ed33037f897ad95651f8ac2d1b233b25b (patch)
tree61268be66356c0af380556882e7304a1c54cf1e5
parentb64733135ad678a80e14a64a54af0b8538fb8fcf (diff)
* fhandler_tty.cc (fhandler_tty_slave::init): Add additional checks to
determine when a process should grab control of a tty's pgid. Use being_debugged() for consistency. * debug.h (being_debugged): Remove vestige of win9x accommodation.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/debug.h3
-rw-r--r--winsup/cygwin/fhandler_tty.cc8
3 files changed, 15 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e25cd553f..98049f48c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-20 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * fhandler_tty.cc (fhandler_tty_slave::init): Add additional checks to
+ determine when a process should grab control of a tty's pgid. Use
+ being_debugged() for consistency.
+ * debug.h (being_debugged): Remove vestige of win9x accommodation.
+
2010-09-19 Christopher Faylor <me+cygwin@cgf.cx>
* wincap.h (wincaps::has_buggy_thread_startup): Declare.
diff --git a/winsup/cygwin/debug.h b/winsup/cygwin/debug.h
index b2333e6fd..d14be53de 100644
--- a/winsup/cygwin/debug.h
+++ b/winsup/cygwin/debug.h
@@ -20,8 +20,7 @@ details. */
#if !defined(_DEBUG_H_)
#define _DEBUG_H_
-#define being_debugged() \
- (IsDebuggerPresent () /* || GetLastError () == ERROR_PROC_NOT_FOUND*/)
+#define being_debugged() (IsDebuggerPresent ())
#ifndef DEBUGGING
# define cygbench(s)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index f0f850f42..632e3aaf0 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -710,7 +710,13 @@ fhandler_tty_slave::init (HANDLE f, DWORD a, mode_t)
flags = O_RDWR;
int ret = open (flags);
- if (ret && !cygwin_finished_initializing && !IsDebuggerPresent ())
+
+ /* 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 ()))
{
/* 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