summaryrefslogtreecommitdiff
path: root/ext/standard/lcg.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2001-05-06 16:54:27 (GMT)
committerfoobar <sniper@php.net>2001-05-06 16:54:27 (GMT)
commit8e006f81afa692ebef76e10b75de2b9361a480d5 (patch)
treee6162da5ad27c7fece4b74a2ea03f24cd8c4a120 /ext/standard/lcg.c
parentd2cbd019e38d3ff520541c0bef783028d321027a (diff)
downloadphp-8e006f81afa692ebef76e10b75de2b9361a480d5.tar.gz
Fix bug: #8834. Now there should be more random salts..
Diffstat (limited to 'ext/standard/lcg.c')
-rw-r--r--ext/standard/lcg.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index be43a77..31321a6 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -31,6 +31,8 @@ int lcg_globals_id;
static php_lcg_globals lcg_globals;
#endif
+static int php_lcg_initialized = 0;
+
#ifdef PHP_WIN32
#include <process.h>
#endif
@@ -71,13 +73,16 @@ static void lcg_init_globals(LCGLS_D)
#endif
}
-PHP_MINIT_FUNCTION(lcg)
+PHP_RINIT_FUNCTION(lcg)
{
+ if (!php_lcg_initialized) {
#ifdef ZTS
- lcg_globals_id = ts_allocate_id(sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL);
+ lcg_globals_id = ts_allocate_id(sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL);
#else
- lcg_init_globals();
+ lcg_init_globals();
#endif
+ php_lcg_initialized = 1;
+ }
return SUCCESS;
}