diff options
author | Christopher Faylor <me@cgf.cx> | 2003-03-01 02:02:42 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-03-01 02:02:42 +0000 |
commit | 005c3065ebdbdf897733268edce15aeb0e7e9fd6 (patch) | |
tree | bf80f7c780a6e0ddd6b3da06f4ab835cb78071d7 /winsup/cygwin/dll_init.cc | |
parent | 27b4082ae7978779342690af5739f13486075b5f (diff) | |
download | cygnal-005c3065ebdbdf897733268edce15aeb0e7e9fd6.tar.gz cygnal-005c3065ebdbdf897733268edce15aeb0e7e9fd6.tar.bz2 cygnal-005c3065ebdbdf897733268edce15aeb0e7e9fd6.zip |
* cygwin.din: Wrap atexit and exit with cygwin, thread-safe functions.
* dcrt0.cc (cygwin_atexit): New function.
(cygwin_exit): Ditto.
Diffstat (limited to 'winsup/cygwin/dll_init.cc')
-rw-r--r-- | winsup/cygwin/dll_init.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index ebb9edbdb..b02cacd51 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -304,8 +304,16 @@ dll_list::load_after_fork (HANDLE parent, dll *first) the parent had some of those. */ if (d.type == DLL_LOAD) { + bool unload = true; HMODULE h = LoadLibraryEx (d.name, NULL, DONT_RESOLVE_DLL_REFERENCES); + if (!h) + { + unload = false; + LoadLibrary (d.name); + } + if (!h) + system_printf ("can't reload %s", d.name); /* See if DLL will load in proper place. If so, free it and reload it the right way. It sort of stinks that we can't invert the order of the FreeLibrary @@ -313,10 +321,13 @@ dll_list::load_after_fork (HANDLE parent, dll *first) should do what we want. However, since the library was loaded above, the second LoadLibrary does not execute it's startup code unless it is first unloaded. */ - if (h == d.handle) + else if (h == d.handle) { - FreeLibrary (h); - LoadLibrary (d.name); + if (unload) + { + FreeLibrary (h); + LoadLibrary (d.name); + } } else if (try2) api_fatal ("unable to remap %s to same address as parent(%p) != %p", |