aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/devices.cc
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-12-21 10:06:10 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-12-22 20:57:29 +0900
commit043b6089e2006dcde31811e35a5de6619a0e0098 (patch)
treedfc50e20359cd657447ffeb66acb70ff5a512dcd /winsup/cygwin/devices.cc
parent25c4ad6ea52fc5451193dc98fc5ab04b1f509302 (diff)
downloadnewlib-043b6089e2006dcde31811e35a5de6619a0e0098.zip
newlib-043b6089e2006dcde31811e35a5de6619a0e0098.tar.gz
newlib-043b6089e2006dcde31811e35a5de6619a0e0098.tar.bz2
Cygwin: devices: Make generic console devices invisible from pty.
The devices /dev/conin,conout,console were wrongly visible from ptys, though they are inaccessible. This is because fhandler_console::exists() returns true due to existing invisible console. This patch makes these devices invisible from ptys. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'winsup/cygwin/devices.cc')
-rw-r--r--winsup/cygwin/devices.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc
index a0762f2..9f6e80a 100644
--- a/winsup/cygwin/devices.cc
+++ b/winsup/cygwin/devices.cc
@@ -9,6 +9,8 @@
#include "path.h"
#include "fhandler.h"
#include "ntdll.h"
+#include "dtable.h"
+#include "cygheap.h"
typedef const _device *KR_device_t;
@@ -76,7 +78,8 @@ exists_console (const device& dev)
case FH_CONSOLE:
case FH_CONIN:
case FH_CONOUT:
- return fhandler_console::exists ();
+ return cygheap && cygheap->ctty && cygheap->ctty->is_console ()
+ && fhandler_console::exists ();
default:
/* Only show my own console device (for now?) */
return iscons_dev (myself->ctty) && myself->ctty == devn;