From 975757698f521dffeb360ced0a5540a922856500 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 4 May 2011 19:19:46 +0000 Subject: [PATCH] * dll_list::detach (dll_list::detach): Avoid doing anything with detach during a failing fork. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/dll_init.cc | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 2919c99b2..243358a84 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2011-05-04 Christopher Faylor + + * dll_list::detach (dll_list::detach): Avoid doing anything with detach + during a failing fork. + 2011-05-04 Christopher Faylor * dll_init.cc (dll_global_dtors): Avoid calling destructors during diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index 99974944b..1b6072a47 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -181,7 +181,10 @@ void dll_list::detach (void *retaddr) { dll *d; - if (!myself) + /* Don't attempt to call destructors if we're still in fork processing + since that likely means fork is failing and everything will not have been + set up. */ + if (!myself || in_forkee) return; guard (true); if ((d = find (retaddr)))