From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id C31D7385B500; Thu, 22 Dec 2022 13:33:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C31D7385B500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671716009; bh=AMzohepJ3dp+kNpAB90A3suDD8+WGOYbU9sxZ99SBOM=; h=From:To:Subject:Date:From; b=rL7OdFMlOKjCUly0qU4lKbJkJH5eZNT8hCnE8NTckcBBjGGsvTdJdakh8UIkiskY5 1FozzE9Z/X+SiGC/g4EMIsNzn5C/gcNQubRpefh3zCRjMbBOYfcY5n1v155gvOiAw0 lLhmfwOP+qT5D2R0JeE/LYJwc2pJJRHVJPTepzwE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: devices: Make generic console devices invisible from pty. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 25c4ad6ea52fc5451193dc98fc5ab04b1f509302 X-Git-Newrev: 043b6089e2006dcde31811e35a5de6619a0e0098 Message-Id: <20221222133329.C31D7385B500@sourceware.org> Date: Thu, 22 Dec 2022 13:33:29 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D043b6089e20= 06dcde31811e35a5de6619a0e0098 commit 043b6089e2006dcde31811e35a5de6619a0e0098 Author: Takashi Yano Date: Wed Dec 21 10:06:10 2022 +0900 Cygwin: devices: Make generic console devices invisible from pty. =20 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. =20 Signed-off-by: Takashi Yano Diff: --- winsup/cygwin/devices.cc | 5 ++++- winsup/cygwin/devices.in | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index a0762f292..9f6e80acb 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" =20 typedef const _device *KR_device_t; =20 @@ -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 =3D=3D devn; diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index 7506dfe9c..48199f46c 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -8,6 +8,8 @@ #include "path.h" #include "fhandler.h" #include "ntdll.h" +#include "dtable.h" +#include "cygheap.h" =20 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 =3D=3D devn;