From 4a301c83d648375daf5a8f711698a966908f15ec Mon Sep 17 00:00:00 2001 From: cgf Date: Wed, 19 Oct 2005 00:22:07 +0000 Subject: [PATCH] * cygtls.cc (handle_threadlist_exception): Improve diagnostic output. * sigproc.cc (child_info::sync): Only clear hProcess when execing. (wait_sig): Protect readsig handle. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/cygtls.cc | 10 ++++------ winsup/cygwin/sigproc.cc | 5 +++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index eb1382e371..4fa3a5e717 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2005-10-18 Christopher Faylor + + * cygtls.cc (handle_threadlist_exception): Improve diagnostic output. + + * sigproc.cc (child_info::sync): Only clear hProcess when execing. + (wait_sig): Protect readsig handle. + 2005-10-18 Corinna Vinschen * autoload.cc (NtLockVirtualMemory): Import. diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index 3b3e86ae28..579e981f29 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -241,26 +241,24 @@ _cygtls::set_siginfo (sigpacket *pack) extern "C" DWORD __stdcall RtlUnwind (void *, void *, void *, DWORD); static int -handle_threadlist_exception (EXCEPTION_RECORD *e, void *frame, CONTEXT *, void *) +handle_threadlist_exception (EXCEPTION_RECORD *e, void *frame, CONTEXT *c, void *) { if (e->ExceptionCode != STATUS_ACCESS_VIOLATION) { - system_printf ("handle_threadlist_exception called with exception code %d\n", - e->ExceptionCode); + system_printf ("unhandled exception %p at %p", e->ExceptionCode, c->Eip); return 1; } sentry here; if (threadlist_ix == BAD_IX) { - system_printf ("handle_threadlist_exception called with threadlist_ix %d\n", - BAD_IX); + system_printf ("called with threadlist_ix %d", BAD_IX); return 1; } if (!here.acquired ()) { - system_printf ("handle_threadlist_exception couldn't aquire muto\n"); + system_printf ("couldn't aquire muto"); return 1; } diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 86ac20c8be..ae44ad7f12 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -846,7 +846,7 @@ child_info::sync (pid_t pid, HANDLE& hProcess, DWORD howlong) } else { - if (type != _PROC_FORK && x == nsubproc_ready) + if (type == _PROC_EXEC && x == nsubproc_ready) { ForceCloseHandle1 (hProcess, childhProcess); hProcess = NULL; @@ -1057,6 +1057,7 @@ wait_sig (VOID *) if (!CreatePipe (&readsig, &myself->sendsig, sec_user_nih (sa_buf), 0)) api_fatal ("couldn't create signal pipe, %E"); + ProtectHandle (readsig); sigCONT = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL); my_sendsig = myself->sendsig; @@ -1186,7 +1187,7 @@ wait_sig (VOID *) break; } - CloseHandle (readsig); + ForceCloseHandle (readsig); sigproc_printf ("signal thread exiting"); ExitThread (0); } -- 2.11.0