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>
This commit is contained in:
parent
fd3ad92f9e
commit
09738c3062
|
@ -1470,17 +1470,14 @@ fhandler_pty_master::fhandler_pty_master (int unit)
|
||||||
{
|
{
|
||||||
if (unit >= 0)
|
if (unit >= 0)
|
||||||
dev ().parse (DEV_PTYM_MAJOR, unit);
|
dev ().parse (DEV_PTYM_MAJOR, unit);
|
||||||
else if (!setup ())
|
|
||||||
{
|
|
||||||
dev ().parse (FH_ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
set_name ("/dev/ptmx");
|
set_name ("/dev/ptmx");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_pty_master::open (int flags, mode_t)
|
fhandler_pty_master::open (int flags, mode_t)
|
||||||
{
|
{
|
||||||
|
if (!setup ())
|
||||||
|
return 0;
|
||||||
set_open_status ();
|
set_open_status ();
|
||||||
dwProcessId = GetCurrentProcessId ();
|
dwProcessId = GetCurrentProcessId ();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -36,3 +36,6 @@ Bug Fixes
|
||||||
|
|
||||||
- Fix assertion failure on an invalid path under /proc/<pid>/fd/.
|
- Fix assertion failure on an invalid path under /proc/<pid>/fd/.
|
||||||
Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246160.html
|
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
|
||||||
|
|
Loading…
Reference in New Issue