Commit b0f45973 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix initialization

parent 04d05b50
...@@ -36,3 +36,17 @@ test_aes_SOURCES = test-aes.c ...@@ -36,3 +36,17 @@ test_aes_SOURCES = test-aes.c
srtp_SOURCES = recv.c srtp_SOURCES = recv.c
srtp_LDADD = libvlc_srtp.la srtp_LDADD = libvlc_srtp.la
lcov-run:
rm -f *.gcda lcov
$(MAKE) $(AM_MAKEFLAGS) check
lcov-pre.out:
lcov -c -d . -o lcov.tmp
lcov.out: lcov-pre.out
lcov -r lcov.tmp '*test*' > lcov.out
lcov: lcov.out
genhtml lcov.out -o lcov
.PHONY: lcov-run
...@@ -90,13 +90,13 @@ static bool libgcrypt_usable = false; ...@@ -90,13 +90,13 @@ static bool libgcrypt_usable = false;
static void initonce_libgcrypt (void) static void initonce_libgcrypt (void)
{ {
if ((gcry_check_version ("1.1.94") == NULL)
|| gcry_control (GCRYCTL_DISABLE_SECMEM, 0)
|| gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0)
#ifndef WIN32 #ifndef WIN32
|| gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread) gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
#endif #endif
)
if ((gcry_check_version ("1.1.94") == NULL)
|| gcry_control (GCRYCTL_DISABLE_SECMEM, 0)
|| gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0))
return; return;
libgcrypt_usable = true; libgcrypt_usable = true;
...@@ -111,13 +111,16 @@ static int init_libgcrypt (void) ...@@ -111,13 +111,16 @@ static int init_libgcrypt (void)
pthread_mutex_lock (&mutex); pthread_mutex_lock (&mutex);
pthread_once (&once, initonce_libgcrypt); pthread_once (&once, initonce_libgcrypt);
retval = -libgcrypt_usable;
pthread_mutex_unlock (&mutex);
#else #else
# warning FIXME: This is not thread-safe. # warning FIXME: This is not thread-safe.
if (!libgcrypt_usable) if (!libgcrypt_usable)
initonce_libgcrypt (); initonce_libgcrypt ();
retval = -libgcrypt_usable; #endif
retval = libgcrypt_usable ? 0 : -1;
#ifndef WIN32
pthread_mutex_unlock (&mutex);
#endif #endif
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment