summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-11-24 02:34:31 +0000
committerChristopher Faylor <me@cgf.cx>2005-11-24 02:34:31 +0000
commit819dbaebd65f8d38cdb5eaf996b8c046e258ce5f (patch)
tree0c6308ca80081ec0f882734e7f27a8e57d0ce571 /winsup/cygwin
parenta39cfda7ba28acc3b3c8251c4b61582ed7bbaca6 (diff)
downloadcygnal-819dbaebd65f8d38cdb5eaf996b8c046e258ce5f.tar.gz
cygnal-819dbaebd65f8d38cdb5eaf996b8c046e258ce5f.tar.bz2
cygnal-819dbaebd65f8d38cdb5eaf996b8c046e258ce5f.zip
* fhandler_tty.cc (fhandler_tty_slave::open): Reset the current windows station
whenever ctty == -1 regardles of whetehr there's a windows station already assigned. Close the old windows station in this situation. * pinfo.cc (_pinfo::set_ctty): Reinstate incrementing of console count when recording ctty so that the current tty is always around.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/autoload.cc1
-rw-r--r--winsup/cygwin/fhandler_tty.cc5
-rw-r--r--winsup/cygwin/pinfo.cc2
4 files changed, 16 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4256a1184..d9b0b673c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,12 @@
+2005-11-23 Christopher Faylor <cgf@timesys.com>
+
+ * fhandler_tty.cc (fhandler_tty_slave::open): Reset the current windows
+ station whenever ctty == -1 regardles of whetehr there's a windows
+ station already assigned. Close the old windows station in this
+ situation.
+ * pinfo.cc (_pinfo::set_ctty): Reinstate incrementing of console count
+ when recording ctty so that the current tty is always around.
+
2005-11-18 Christopher Faylor <cgf@timesys.com>
* strptime.cc (_strptime): Fix gcc warnings.
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index a71599db9..0a328c70a 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -413,6 +413,7 @@ LoadDLLfuncEx (LsaRegisterLogonProcess, 12, secur32, 1)
LoadDLLfunc (CharToOemA, 8, user32)
LoadDLLfunc (CharToOemBuffA, 12, user32)
LoadDLLfunc (CloseClipboard, 0, user32)
+LoadDLLfunc (CloseWindowStation, 4, user32)
LoadDLLfunc (CreateWindowExA, 48, user32)
LoadDLLfunc (CreateWindowStationA, 16, user32)
LoadDLLfunc (DefWindowProcA, 16, user32)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 559819fee..5b7e69ba5 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -580,7 +580,8 @@ fhandler_tty_slave::open (int flags, mode_t)
&& wincap.pty_needs_alloc_console ())
{
BOOL b;
- if (!GetProcessWindowStation ())
+ HWINSTA horig = GetProcessWindowStation ();
+ if (myself->ctty == -1)
{
HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih);
termios_printf ("CreateWindowStation %p, %E", h);
@@ -589,6 +590,8 @@ fhandler_tty_slave::open (int flags, mode_t)
b = SetProcessWindowStation (h);
termios_printf ("SetProcessWindowStation %d, %E", b);
}
+ if (horig)
+ CloseWindowStation (horig);
}
b = AllocConsole (); // will cause flashing if workstation
// stuff fails
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 9b3b39cb7..fb3c9da14 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -365,6 +365,8 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch)
if (arch)
{
arch->usecount++;
+ /* guard ctty arch */
+ cygheap->manage_console_count ("_pinfo::set_ctty", 1);
report_tty_counts (cygheap->ctty, "ctty", "");
}
}