From: Ilia Alshanetsky Date: Wed, 20 Aug 2003 16:40:46 +0000 (+0000) Subject: MFH: Fixed bug #25170 (Problem with generation of random numbers on solaris) X-Git-Tag: php-4.3.3~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60097c2661bb6c1fbd4557025efc29108755a9fc;p=php MFH: Fixed bug #25170 (Problem with generation of random numbers on solaris) --- diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index 1d6dd39384..e72f3ed02d 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -33,7 +33,7 @@ #define RAND_MAX (1<<15) #endif -#if HAVE_LRAND48 && !defined(__sun) +#if defined(HAVE_LRAND48) || defined(HAVE_RANDOM) #define PHP_RAND_MAX 2147483647 #else #define PHP_RAND_MAX RAND_MAX diff --git a/main/reentrancy.c b/main/reentrancy.c index e5354891e4..b2a4c8eb60 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -34,7 +34,7 @@ #endif #include "php_reentrancy.h" -#include "ext/standard/php_rand.h" /* for RAND_MAX */ +#include "ext/standard/php_rand.h" /* for PHP_RAND_MAX */ enum { LOCALTIME_R, @@ -367,7 +367,7 @@ void reentrancy_shutdown(void) static int do_rand(unsigned long *ctx) { - return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1)); + return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)PHP_RAND_MAX + 1)); }