From 13b82f5706ee9f430203c2559250056e5e12de72 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 10 Aug 2017 11:54:15 +1000 Subject: Remove mutex from dl_anchor All call sites already hold a single mutex --- src/openssl.c | 7 +------ 1 file changed, 1 insertion(+), 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; -- cgit v1.2.3-59-g8ed1b