]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: devices: Make generic console devices invisible from pty.
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 21 Dec 2022 01:06:10 +0000 (10:06 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Thu, 22 Dec 2022 11:57:29 +0000 (20:57 +0900)
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>
winsup/cygwin/devices.cc
winsup/cygwin/devices.in

index a0762f292c9afae7f04dcff4884aaf038edc81ff..9f6e80acbb6ff4c0dbdc1baebe1010142defd6c2 100644 (file)
@@ -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;
index 7506dfe9cb93b8c799e5a3d516f6882bb83b27fd..48199f46cd2c7846887314330aea12a69dfe16ce 100644 (file)
@@ -8,6 +8,8 @@
 #include "path.h"
 #include "fhandler.h"
 #include "ntdll.h"
+#include "dtable.h"
+#include "cygheap.h"
 
 typedef const _device *KR_device_t;
 }
@@ -72,7 +74,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;
This page took 0.043149 seconds and 5 git commands to generate.