From ce40c6baf7c779c6b2a63e41bf21596c96dff506 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 10 Dec 2003 03:19:19 +0000 Subject: * fhandler_tty.cc (fhandler_tty_common::dup): Just copy cygheap->ctty to child if duping the current ctty. (fhandler_tty_common::close): Move debugging statement earlier in function. (fhandler_tty_slave::close): Return success when closing ctty. * syscalls.cc (close_all_files): Avoid calling fhandler_tty_slave close method so that open_fhs will not be decremented when closing cygheap ctty. (setsid): Ditto. * dcrt0.cc (do_exit): Reorganize to avoid leaving a critical section active after vfork. * fhandler.h (fhandler_tty_slave::get_unit): Remove regparm parameter since it can't work in a virtualized function. --- winsup/cygwin/dcrt0.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'winsup/cygwin/dcrt0.cc') diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 0f6a133a3..31655c0bd 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -952,21 +952,23 @@ extern CRITICAL_SECTION exit_lock; void __stdcall do_exit (int status) { + syscall_printf ("do_exit (%d), exit_state %d", status, exit_state); + + vfork_save *vf = vfork_storage.val (); + if (vf != NULL && vf->pid < 0) + { + exit_state = ES_NOT_EXITING; + vf->restore_exit (status); + } + + EnterCriticalSection (&exit_lock); if (exit_state < ES_EVENTS_TERMINATE) { exit_state = ES_EVENTS_TERMINATE; events_terminate (); } - EnterCriticalSection (&exit_lock); UINT n = (UINT) status; - - syscall_printf ("do_exit (%d)", n); - - vfork_save *vf = vfork_storage.val (); - if (vf != NULL && vf->pid < 0) - vf->restore_exit (status); - if (exit_state < ES_THREADTERM) { exit_state = ES_THREADTERM; -- cgit v1.2.3