From 3a1ccfc8c7e618eec1eb280a213282f1134eb2fb Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 7 Mar 2004 04:57:47 +0000 Subject: * fork.cc (fork_parent): Save parent pid in a temporary variable since child could conceivably exit before function returns, rendering the child's shared memory area invalid. * cygtls.h (_cygtls::incyg): Declare new field. (_cygtls::in_exception): Define new function. * exceptions.cc (setup_handler): Remove locked flag. Use 'incyg' flag and in_exception function to determine when we're in a cygwin function. (_cygtls::call_signal_handler): Decrement incyg flag prior to calling a handler. Increment it on return. * gendef (_sigfe): Increment incyg flag. Use testl for zero testing rather than orl, for consistency. (_sigbe): Decrement incyg flag. Use testl for zero testing rather than orl, for consistency. (_cygtls::pop): Use testl for zero testing rather than orl, for consistency. (stabilize_sig_stack): Ditto. --- winsup/cygwin/fork.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/fork.cc') diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index c26d2d678..0103b0dd3 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -512,6 +512,10 @@ fork_parent (HANDLE& hParent, dll *&first_dll, goto cleanup; } + int forked_pid; + + forked_pid = forked->pid; + /* Initialize things that are done later in dll_crt0_1 that aren't done for the forkee. */ strcpy (forked->progname, myself->progname); @@ -621,7 +625,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, pi.hThread = NULL; pthread::atforkparent (); - return forked->pid; + return forked_pid; /* Common cleanup code for failure cases */ cleanup: -- cgit v1.2.3