diff -urp cygwin.old/winsup/cygwin/dll_init.cc cygwin/winsup/cygwin/dll_init.cc --- cygwin.old/winsup/cygwin/dll_init.cc Thu Nov 1 01:30:03 2001 +++ cygwin/winsup/cygwin/dll_init.cc Wed Apr 17 08:44:23 2002 @@ -59,6 +59,11 @@ void per_module::run_dtors () { void (**pfunc)() = dtors; + + if( dtors_run ) + return; + dtors_run = true; + for (int i = 1; pfunc[i]; i++) (pfunc[i]) (); } @@ -71,6 +76,8 @@ dll::init () /* Why didn't we just import this variable? */ *(p.envptr) = __cygwin_environ; + + p.dtors_run = false; /* Don't run constructors or the "main" if we've forked. */ if (!in_forkee) diff -urp cygwin.old/winsup/cygwin/dll_init.h cygwin/winsup/cygwin/dll_init.h --- cygwin.old/winsup/cygwin/dll_init.h Sun Nov 4 22:39:38 2001 +++ cygwin/winsup/cygwin/dll_init.h Wed Apr 17 08:43:53 2002 @@ -13,6 +13,7 @@ struct per_module char ***envptr; void (**ctors)(void); void (**dtors)(void); + bool dtors_run; void *data_start; void *data_end; void *bss_start;