diff --git a/crypto/thread_pthread.c b/crypto/thread_pthread.c index 59c4b8d1..68aaab5b 100644 --- a/crypto/thread_pthread.c +++ b/crypto/thread_pthread.c @@ -17,6 +17,7 @@ #if !defined(OPENSSL_WINDOWS) && !defined(OPENSSL_NO_THREADS) #include +#include #include #include @@ -74,7 +75,11 @@ void CRYPTO_STATIC_MUTEX_unlock(struct CRYPTO_STATIC_MUTEX *lock) { } void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void)) { - pthread_once(once, init); + if (pthread_once(once, init) != 0) { + fprintf(stderr, + "pthread_once failed. Did you link against a threading library?\n"); + abort(); + } } static pthread_mutex_t g_destructors_lock = PTHREAD_MUTEX_INITIALIZER;