diff options
author | Christopher Faylor <me@cgf.cx> | 2001-06-03 14:13:12 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-06-03 14:13:12 +0000 |
commit | aa7a61121e3de86aba370055852a75caca041c97 (patch) | |
tree | 51dc9fd8ab55c90ac72e18d19839804737fd1220 /winsup/cygwin/dlfcn.cc | |
parent | 77d130214c17469e2f6a6d9cb14ebe83acbb42dc (diff) | |
download | newlib-aa7a61121e3de86aba370055852a75caca041c97.zip newlib-aa7a61121e3de86aba370055852a75caca041c97.tar.gz newlib-aa7a61121e3de86aba370055852a75caca041c97.tar.bz2 |
* dlfcn.cc (dlclose): Do not call FreeLibrary if the symbol to close was
obtained by dlopen(NULL,...).
Diffstat (limited to 'winsup/cygwin/dlfcn.cc')
-rw-r--r-- | winsup/cygwin/dlfcn.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc index d1aef52..39add1d 100644 --- a/winsup/cygwin/dlfcn.cc +++ b/winsup/cygwin/dlfcn.cc @@ -129,10 +129,12 @@ dlclose (void *handle) SetResourceLock(LOCK_DLL_LIST,READ_LOCK|WRITE_LOCK," dlclose"); int ret = -1; - if (FreeLibrary ((HMODULE) handle)) + void *temphandle = (void *) GetModuleHandle (NULL); + if (temphandle == handle || FreeLibrary ((HMODULE) handle)) ret = 0; if (ret) set_dl_error ("dlclose"); + CloseHandle ((HMODULE) temphandle); ReleaseResourceLock(LOCK_DLL_LIST,READ_LOCK|WRITE_LOCK," dlclose"); return ret; |