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:
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/devices.cc6
-rw-r--r--winsup/cygwin/devices.in6
-rw-r--r--winsup/cygwin/fhandler_console.cc7
4 files changed, 15 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 5e444b56d..be7da923b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-12 Christopher Faylor <me.cygwin2012@cgf.cx>
+
+ * devices.in (exists_console): Allow /dev/con{sole,in,out} to be
+ referenced they exist.
+ * devices.cc: Regenerate.
+ * fhandler_console.cc (fhandler_console::set_unit): Ditto.
+
2012-04-11 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (fhandler_base::stat_fixup): Fix inode numbers of
diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc
index 1c4a851b9..d67bcf4ba 100644
--- a/winsup/cygwin/devices.cc
+++ b/winsup/cygwin/devices.cc
@@ -67,18 +67,16 @@ exists_ntdev_silent (const device& dev)
static int
exists_console (const device& dev)
{
- if (!iscons_dev (myself->ctty))
- return false;
int devn = *const_cast<device *> (&dev);
switch (devn)
{
case FH_CONSOLE:
case FH_CONIN:
case FH_CONOUT:
- return true;
+ return !!GetConsoleCP ();
default:
/* Only show my own console device (for now?) */
- return myself->ctty == devn;
+ return iscons_dev (myself->ctty) && myself->ctty == devn;
}
}
diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in
index e5032f6ca..b656886ee 100644
--- a/winsup/cygwin/devices.in
+++ b/winsup/cygwin/devices.in
@@ -63,18 +63,16 @@ exists_ntdev_silent (const device& dev)
static int
exists_console (const device& dev)
{
- if (!iscons_dev (myself->ctty))
- return false;
int devn = *const_cast<device *> (&dev);
switch (devn)
{
case FH_CONSOLE:
case FH_CONIN:
case FH_CONOUT:
- return true;
+ return !!GetConsoleCP ();
default:
/* Only show my own console device (for now?) */
- return myself->ctty == devn;
+ return iscons_dev (myself->ctty) && myself->ctty == devn;
}
}
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 7478eae19..d2e993fb0 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -136,18 +136,19 @@ fhandler_console::set_unit ()
fh_devices devset;
lock_ttys here;
HWND me;
+ fh_devices this_unit = dev ();
+ bool generic_console = this_unit == FH_CONIN || this_unit == FH_CONOUT;
if (shared_console_info)
{
- fh_devices this_unit = dev ();
fh_devices shared_unit =
(fh_devices) shared_console_info->tty_min_state.getntty ();
devset = (shared_unit == this_unit || this_unit == FH_CONSOLE
- || this_unit == FH_CONIN || this_unit == FH_CONOUT
+ || generic_console
|| this_unit == FH_TTY) ?
shared_unit : FH_ERROR;
created = false;
}
- else if ((myself->ctty != -1 && !iscons_dev (myself->ctty))
+ else if ((!generic_console && (myself->ctty != -1 && !iscons_dev (myself->ctty)))
|| !(me = GetConsoleWindow ()))
devset = FH_ERROR;
else