diff options
author | daurnimator <quae@daurnimator.com> | 2017-08-10 11:54:15 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-08-10 11:54:15 +1000 |
commit | 13b82f5706ee9f430203c2559250056e5e12de72 (patch) | |
tree | 07fdc526112666d17ecbac6471ba154f90f18a9a | |
parent | 39a4e527933a6b46234ff6f229469a68d9d455ac (diff) | |
download | luaossl-13b82f5706ee9f430203c2559250056e5e12de72.tar.gz luaossl-13b82f5706ee9f430203c2559250056e5e12de72.tar.bz2 luaossl-13b82f5706ee9f430203c2559250056e5e12de72.zip |
Remove mutex from dl_anchor
All call sites already hold a single mutex
-rw-r--r-- | src/openssl.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/openssl.c b/src/openssl.c index df559d7..9fc5b97 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -1227,17 +1227,14 @@ static const EVP_MD *auxL_optdigest(lua_State *L, int index, EVP_PKEY *key, cons * Prevent loader from unlinking us if we've registered a callback with * OpenSSL by taking another reference to ourselves. */ +/* dl_anchor must not be called from multiple threads at once */ static int dl_anchor(void) { #if HAVE_DLADDR extern int luaopen__openssl(lua_State *); - static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static void *anchor; Dl_info info; int error = 0; - if ((error = pthread_mutex_lock(&mutex))) - return error; - if (anchor) goto epilog; @@ -1247,8 +1244,6 @@ static int dl_anchor(void) { if (!(anchor = dlopen(info.dli_fname, RTLD_NOW|RTLD_LOCAL))) goto dlerr; epilog: - (void)pthread_mutex_unlock(&mutex); - return error; dlerr: error = auxL_EDYLD; |