From 935b1ba0c2c3dc480b0afcb3673abe2ef2dd893f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 13 Mar 2014 13:37:25 +0000 Subject: [PATCH] Always initialize libgcrypt for POSIX threads YAZ-751 gnutls_global_init, we now know, in some systems, do not properly initialize libgcrypt for POSIX threads. --- src/init_globals.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/init_globals.c b/src/init_globals.c index 79845f4..abb918b 100644 --- a/src/init_globals.c +++ b/src/init_globals.c @@ -50,6 +50,10 @@ void yaz_init_globals(void) if (!yaz_init_flag) { yaz_log_init_globals(); +#if HAVE_GCRYPT_H + /* POSIX threads locking. gnutls_global_init will not override */ + gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); +#endif #if HAVE_GNUTLS_H gnutls_global_init(); #endif @@ -57,7 +61,6 @@ void yaz_init_globals(void) /* most likely, GnuTLS has already initialized libgcrypt */ if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) { - gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0); } #endif -- 1.7.10.4