iliaa Wed Aug 20 12:40:47 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/main reentrancy.c
/php-src/ext/standard php_rand.h
Log:
MFH: Fixed bug #25170 (Problem with generation of random numbers on solaris)
Index: php-src/main/reentrancy.c
diff -u php-src/main/reentrancy.c:1.35.2.1 php-src/main/reentrancy.c:1.35.2.2
--- php-src/main/reentrancy.c:1.35.2.1 Tue Dec 31 11:26:24 2002
+++ php-src/main/reentrancy.c Wed Aug 20 12:40:45 2003
@@ -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 @@
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));
}
Index: php-src/ext/standard/php_rand.h
diff -u php-src/ext/standard/php_rand.h:1.19.4.3
php-src/ext/standard/php_rand.h:1.19.4.4
--- php-src/ext/standard/php_rand.h:1.19.4.3 Sun Aug 10 20:43:32 2003
+++ php-src/ext/standard/php_rand.h Wed Aug 20 12:40:46 2003
@@ -20,7 +20,7 @@
| Based on code from: Shawn Cokus <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_rand.h,v 1.19.4.3 2003/08/11 00:43:32 sniper Exp $ */
+/* $Id: php_rand.h,v 1.19.4.4 2003/08/20 16:40:46 iliaa Exp $ */
#ifndef PHP_RAND_H
#define 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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php