summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_console.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 5be7111ff..7478eae19 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -141,18 +141,15 @@ fhandler_console::set_unit ()
fh_devices this_unit = dev ();
fh_devices shared_unit =
(fh_devices) shared_console_info->tty_min_state.getntty ();
- created = false;
devset = (shared_unit == this_unit || this_unit == FH_CONSOLE
|| this_unit == FH_CONIN || this_unit == FH_CONOUT
|| this_unit == FH_TTY) ?
shared_unit : FH_ERROR;
+ created = false;
}
else if ((myself->ctty != -1 && !iscons_dev (myself->ctty))
|| !(me = GetConsoleWindow ()))
- {
- created = false;
- devset = FH_ERROR;
- }
+ devset = FH_ERROR;
else
{
created = true;
@@ -166,6 +163,12 @@ fhandler_console::set_unit ()
dev ().parse (devset);
if (devset != FH_ERROR)
pc.file_attributes (FILE_ATTRIBUTE_NORMAL);
+ else
+ {
+ set_io_handle (NULL);
+ set_output_handle (NULL);
+ created = false;
+ }
return created;
}