From 06e7d5e9cbfbed128596ebeb9b031188e7632aae Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Tue, 15 Jun 2010 09:26:22 +0000 Subject: [PATCH] - Fix #51424, crypt() function hangs after 3rd call --- ext/standard/php_crypt_r.c | 10 ++++++---- ext/standard/var_unserializer.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index d04d4dd78d..91063003e7 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -81,11 +81,13 @@ void _crypt_extended_init_r(void) tsrm_mutex_lock(php_crypt_extended_init_lock); #endif - if (initialized) { - return; - } else { + if (!initialized) { +#ifdef PHP_WIN32 + InterlockedIncrement(initialized); +#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) + __sync_fetch_and_add(&initialized, 1); +#endif _crypt_extended_init(); - initialized = 1; } #ifdef ZTS tsrm_mutex_unlock(php_crypt_extended_init_lock); diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 4ccc2b322a..a33187b9f8 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed May 26 09:11:18 2010 */ +/* Generated by re2c 0.13.5 on Mon Jun 14 12:03:55 2010 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ -- 2.49.0