From: RĂ©mi Denis-Courmont Date: Thu, 17 May 2007 17:03:56 +0000 (+0000) Subject: Fix initialization X-Git-Tag: 0.9.0-test0~7394 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=b0f459734980ed8bc36fd968587c64f77c72aa4b;p=vlc Fix initialization --- diff --git a/libs/srtp/Makefile.am b/libs/srtp/Makefile.am index 74c4bafe04..7c95859eb5 100644 --- a/libs/srtp/Makefile.am +++ b/libs/srtp/Makefile.am @@ -36,3 +36,17 @@ test_aes_SOURCES = test-aes.c srtp_SOURCES = recv.c 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 diff --git a/libs/srtp/srtp.c b/libs/srtp/srtp.c index daf0e18d20..efc434fdd8 100644 --- a/libs/srtp/srtp.c +++ b/libs/srtp/srtp.c @@ -90,13 +90,13 @@ static bool libgcrypt_usable = false; 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 - || gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread) + gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); #endif - ) + + if ((gcry_check_version ("1.1.94") == NULL) + || gcry_control (GCRYCTL_DISABLE_SECMEM, 0) + || gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0)) return; libgcrypt_usable = true; @@ -111,13 +111,16 @@ static int init_libgcrypt (void) pthread_mutex_lock (&mutex); pthread_once (&once, initonce_libgcrypt); - retval = -libgcrypt_usable; - pthread_mutex_unlock (&mutex); #else # warning FIXME: This is not thread-safe. if (!libgcrypt_usable) initonce_libgcrypt (); - retval = -libgcrypt_usable; +#endif + + retval = libgcrypt_usable ? 0 : -1; + +#ifndef WIN32 + pthread_mutex_unlock (&mutex); #endif return retval;