summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2020-09-09 22:50:11 +0200
committerCorinna Vinschen <corinna@vinschen.de>2020-09-09 22:57:09 +0200
commit09738c30627c20770d2a1cfa33aaf233bb77d035 (patch)
treed9e5d979666e1973438424084132b79500f56099
parentfd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d (diff)
downloadcygnal-09738c30627c20770d2a1cfa33aaf233bb77d035.tar.gz
cygnal-09738c30627c20770d2a1cfa33aaf233bb77d035.tar.bz2
cygnal-09738c30627c20770d2a1cfa33aaf233bb77d035.zip
Cygwin: pty: setup new pty on opening the master, not in constructor
Setting up the pty in the master constructor ends up creating a new pty on every stat(2) call on /dev/ptmx. Only do this when actually opening the device, not when using the device class in another, non-opening context. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/fhandler_tty.cc7
-rw-r--r--winsup/cygwin/release/3.2.03
2 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 16d4a99f4..37d033bbe 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1470,17 +1470,14 @@ fhandler_pty_master::fhandler_pty_master (int unit)
{
if (unit >= 0)
dev ().parse (DEV_PTYM_MAJOR, unit);
- else if (!setup ())
- {
- dev ().parse (FH_ERROR);
- return;
- }
set_name ("/dev/ptmx");
}
int
fhandler_pty_master::open (int flags, mode_t)
{
+ if (!setup ())
+ return 0;
set_open_status ();
dwProcessId = GetCurrentProcessId ();
return 1;
diff --git a/winsup/cygwin/release/3.2.0 b/winsup/cygwin/release/3.2.0
index 57d6d5147..11de87dbc 100644
--- a/winsup/cygwin/release/3.2.0
+++ b/winsup/cygwin/release/3.2.0
@@ -36,3 +36,6 @@ Bug Fixes
- Fix assertion failure on an invalid path under /proc/<pid>/fd/.
Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246160.html
+
+- Fix crash on stat(2)'ing /dev/ptmx on 32 bit
+ Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246218.html