diff options
author | Christopher Faylor <me@cgf.cx> | 2000-10-17 05:42:04 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-10-17 05:42:04 +0400 |
commit | 92e1969051640fe2c25a8862162eb1a59bd0b888 (patch) | |
tree | f5ec28a82dbf3c1d02b647487934de9fc9db57c1 /winsup/cygwin/fhandler_tty.cc | |
parent | 166b2571ce446b4085d4c2067b0d0d36c608f131 (diff) |
* debug.cc (add_handle): Issue warning on attempts to add the same handle more
than once.
* fhandler_tty.cc (fhandler_tty_slave::open): Protect some handles.
(fhandler_tty_common::close): Use proper name when closing handles.
(fhandler_pty_master::close): Don't close to_slave or from_slave since they've
already been closed earlier in the function.
* sigproc.cc (proc_subproc): Don't protect vchild->hProcess. Expect that the
caller will do this, instead.
* tty.cc (tty_list::terminate): Use proper name when closing handles.
(tty::make_pipes): Protect some handles.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 7a85e1ac5..01a5a9691 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -503,6 +503,7 @@ fhandler_tty_slave::open (const char *, int flags, mode_t) return 0; } set_io_handle (nh); + ProtectHandle1 (nh, from_pty); termios_printf ("duplicated from_master %p->%p from tty_owner %p", get_ttyp ()->from_master, nh, tty_owner); if (!DuplicateHandle (tty_owner, get_ttyp ()->to_master, hMainProc, &nh, 0, TRUE, @@ -513,6 +514,7 @@ fhandler_tty_slave::open (const char *, int flags, mode_t) return 0; } set_output_handle (nh); + ProtectHandle1 (nh, to_pty); CloseHandle (tty_owner); termios_printf("tty%d opened", ttynum); @@ -886,9 +888,9 @@ fhandler_tty_common::close () termios_printf ("CloseHandle (inuse), %E"); if (!ForceCloseHandle (output_mutex)) termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex); - if (!CloseHandle (get_handle ())) + if (!ForceCloseHandle1 (get_handle (), from_pty)) termios_printf ("CloseHandle (get_handle ()<%p>), %E", get_handle ()); - if (!CloseHandle (get_output_handle ())) + if (!ForceCloseHandle1 (get_output_handle (), to_pty)) termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ()); inuse = NULL; @@ -908,10 +910,12 @@ fhandler_pty_master::close () if (!get_ttyp ()->master_alive ()) { termios_printf ("freeing tty%d (%d)", ttynum, get_ttyp ()->ntty); +#if 0 if (get_ttyp ()->to_slave) - CloseHandle (get_ttyp ()->to_slave); + ForceCloseHandle1 (get_ttyp ()->to_slave, to_slave); if (get_ttyp ()->from_slave) - CloseHandle (get_ttyp ()->from_slave); + ForceCloseHandle1 (get_ttyp ()->from_slave, from_slave); +#endif if (get_ttyp ()->from_master) CloseHandle (get_ttyp ()->from_master); if (get_ttyp ()->to_master) @@ -1037,6 +1041,8 @@ fhandler_pty_master::set_close_on_exec (int val) { get_ttyp ()->from_slave = get_handle (); get_ttyp ()->to_slave = get_output_handle (); + termios_printf ("from_slave %p, to_slave %p", get_handle (), + get_output_handle ()); } } |