diff options
author | foobar <sniper@php.net> | 2001-05-06 16:54:27 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2001-05-06 16:54:27 +0000 |
commit | 8e006f81afa692ebef76e10b75de2b9361a480d5 (patch) | |
tree | e6162da5ad27c7fece4b74a2ea03f24cd8c4a120 /ext/standard/lcg.c | |
parent | d2cbd019e38d3ff520541c0bef783028d321027a (diff) | |
download | php-git-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.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index be43a77124..31321a6c81 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; } |