aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>2021-01-15 17:32:11 +0900
committerCorinna Vinschen <corinna@vinschen.de>2021-01-18 11:02:46 +0100
commit85ea2614f5c911f468b37fad6865b45102e47a2f (patch)
tree92bb252dc58f3ffba41d5c52a49d2ee77207e37c /winsup/cygwin/spawn.cc
parent974e6d76d85a284add338d95bea9703e16a693d6 (diff)
downloadnewlib-85ea2614f5c911f468b37fad6865b45102e47a2f.zip
newlib-85ea2614f5c911f468b37fad6865b45102e47a2f.tar.gz
newlib-85ea2614f5c911f468b37fad6865b45102e47a2f.tar.bz2
Cygwin: pty: Make close_pseudoconsole() be a static member function.
- The function close_pseudoconsole() should be static so that it can be safely called in spawn.cc even after the fhandler_pty_slave instance has been deleted. That is, there is a problem with the current code. This patch fixes the issue.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 94909df..bf1b080 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -664,6 +664,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
init_console_handler (myself->ctty > 0);
bool enable_pcon = false;
+ tty *ptys_ttyp = NULL;
STARTUPINFOEXW si_pcon;
ZeroMemory (&si_pcon, sizeof (si_pcon));
STARTUPINFOW *si_tmp = &si;
@@ -677,6 +678,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
c_flags |= EXTENDED_STARTUPINFO_PRESENT;
si_tmp = &si_pcon.StartupInfo;
enable_pcon = true;
+ ptys_ttyp = ptys_primary->get_ttyp ();
}
}
@@ -954,7 +956,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
if (enable_pcon)
{
WaitForSingleObject (pi.hProcess, INFINITE);
- ptys_primary->close_pseudoconsole ();
+ fhandler_pty_slave::close_pseudoconsole (ptys_ttyp);
}
else if (cons_native)
{
@@ -973,7 +975,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
if (waitpid (cygpid, &res, 0) != cygpid)
res = -1;
if (enable_pcon)
- ptys_primary->close_pseudoconsole ();
+ fhandler_pty_slave::close_pseudoconsole (ptys_ttyp);
else if (cons_native)
{
fhandler_console::request_xterm_mode_output (true,