From 8c43a9f82e078662b70a1777f232edd7b37dfa02 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 6 Dec 2004 00:29:41 +0000 Subject: * fork.cc (fork_parent): Reinstate "childhProc" protection. Don't close hProcess handle here since it is used to ensure that a new process isn't created with the old pid after the old pid exits. * spawn.cc (spawn_guts): Ditto. * pinfo.cc (proc_waiter): Don't send any signals if we've execed since this process doesn't officially exist. * pinfo.h (pinfo::pid_handle): Eliminate. Just use hProc. * sigproc.cc (sig_send): Don't send any signals if our sendsig doesn't exist. That's a sign that we are execing. (remove_proc): Eliminate pid_handle close. --- winsup/cygwin/sigproc.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index bc1d6fff6..7b3ba89ad 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -82,6 +82,8 @@ static bool __stdcall remove_proc (int); static bool __stdcall stopped_or_terminated (waitq *, _pinfo *); static DWORD WINAPI wait_sig (VOID *arg); +extern HANDLE hExeced; + /* wait_sig bookkeeping */ class pending_signals @@ -501,7 +503,6 @@ sigproc_init () void __stdcall sigproc_terminate (void) { - extern HANDLE hExeced; hwait_sig = NULL; if (myself->sendsig == INVALID_HANDLE_VALUE) @@ -509,7 +510,6 @@ sigproc_terminate (void) else { sigproc_printf ("entering"); - // finished with anything it is doing if (!hExeced) { HANDLE sendsig = myself->sendsig; @@ -545,6 +545,9 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) sigpacket pack; pack.wakeup = NULL; + if (!myself->sendsig) // FIXME: This catches the exec case but what if the exec is going to fail? + goto out; + bool wait_for_completion; if (!(its_me = (p == NULL || p == myself || p == myself_nowait))) wait_for_completion = false; @@ -657,7 +660,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) { if (no_signals_available ()) sigproc_printf ("I'm going away now"); - else + else if (!hExeced) system_printf ("error sending signal %d to pid %d, pipe handle %p, %E", si.si_signo, p->pid, sendsig); } @@ -857,8 +860,6 @@ remove_proc (int ci) if (procs[ci] != myself) { procs[ci].release (); - if (procs[ci].pid_handle) - ForceCloseHandle1 (procs[ci].pid_handle, childhProc); if (procs[ci].hProcess) ForceCloseHandle1 (procs[ci].hProcess, childhProc); } -- cgit v1.2.3