Index: tls.c ================================================================== --- tls.c +++ tls.c @@ -1732,21 +1732,20 @@ static int TlsLibInit (void) { static int initialized = 0; int i; char rnd_seed[16] = "GrzSlplKqUdnnzP!"; /* 16 bytes */ int status=TCL_OK; -#if defined(OPENSSL_THREADS) && defined(TCL_THREADS) - size_t num_locks; if (initialized) { return status; } - Tcl_MutexLock(&init_mx); - if (!initialized) { - initialized = 1; -#else - { + initialized = 1; + +#if defined(OPENSSL_THREADS) && defined(TCL_THREADS) + size_t num_locks; + + Tcl_MutexLock(&init_mx); #endif if (CRYPTO_set_mem_functions((void *(*)(size_t))Tcl_Alloc, (void *(*)(void *, size_t))Tcl_Realloc, (void(*)(void *))Tcl_Free) == 0) { @@ -1787,14 +1786,12 @@ for (i = 0; i < 16; i++) { rnd_seed[i] = 1 + (char) (255.0 * rand()/(RAND_MAX+1.0)); } RAND_seed(rnd_seed, sizeof(rnd_seed)); } while (RAND_status() != 1); - } - done: #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexUnlock(&init_mx); #endif return status; }