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>2012-03-29 21:34:55 +0400
committerChristopher Faylor <me@cgf.cx>2012-03-29 21:34:55 +0400
commitd46ed263afc680ce6a7f84114a3014b84e447987 (patch)
treeb6eccf83810654d87686da9d0e863ed050699515 /winsup/cygwin/fhandler_console.cc
parent60ecc3d68b188766e53dd314b40a0eb1192425ae (diff)
* fhandler_console.cc (fhandler_console::set_unit): Don't succeed unless we are
opening a console actually associated with this process.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index a3553a728..5be7111ff 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -135,6 +135,7 @@ fhandler_console::set_unit ()
bool created;
fh_devices devset;
lock_ttys here;
+ HWND me;
if (shared_console_info)
{
fh_devices this_unit = dev ();
@@ -146,9 +147,14 @@ fhandler_console::set_unit ()
|| this_unit == FH_TTY) ?
shared_unit : FH_ERROR;
}
+ else if ((myself->ctty != -1 && !iscons_dev (myself->ctty))
+ || !(me = GetConsoleWindow ()))
+ {
+ created = false;
+ devset = FH_ERROR;
+ }
else
{
- HWND me = GetConsoleWindow ();
created = true;
shared_console_info = open_shared_console (me, cygheap->console_h, created);
ProtectHandleINH (cygheap->console_h);