summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-12-15 21:49:19 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-06-24 23:33:48 +0200
commitf4aaa2144173ed4d90c72f14c0da32ebc553a798 (patch)
tree41a70fcd391c148d327a717a418c8890dc653492
parentceab4452f1da38696d5526a65d6fc6775e0affed (diff)
downloadcygnal-f4aaa2144173ed4d90c72f14c0da32ebc553a798.tar.gz
cygnal-f4aaa2144173ed4d90c72f14c0da32ebc553a798.tar.bz2
cygnal-f4aaa2144173ed4d90c72f14c0da32ebc553a798.zip
fhandler_pty_master::pty_master_thread: Always check for correct pid
-rw-r--r--winsup/cygwin/fhandler_tty.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index bf912ffba..aba469f00 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1517,10 +1517,8 @@ fhandler_pty_slave::fixup_after_exec ()
A special case is when the master side of the tty is about to be closed.
The client side is the fhandler_pty_master::close function and it sends
- a PID -1 in that case. On Vista and later a check is performed that the
- request to leave really comes from the master process itself. On earlier
- OSes there's no function to check for the PID of the client process so
- we have to trust the client side.
+ a PID -1 in that case. A check is performed that the request to leave
+ really comes from the master process itself.
Since there's always only one pipe instance, there's a chance that clients
have to wait to connect to the master control pipe. Therefore the client
@@ -1595,10 +1593,8 @@ fhandler_pty_master::pty_master_thread ()
}
if (req.pid == (DWORD) -1) /* Request to finish thread. */
{
- /* Pre-Vista: Just believe in the good of the client process.
- Post-Vista: Check if the requesting process is the master
- process itself. */
- if (pid == (DWORD) -1 || pid == GetCurrentProcessId ())
+ /* Check if the requesting process is the master process itself. */
+ if (pid == GetCurrentProcessId ())
exit = true;
goto reply;
}