1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Clean up bogosities in use of random(3) and srandom(3) --- do not assume

that RAND_MAX applies to them, since it doesn't.  Instead add a
config.h parameter MAX_RANDOM_VALUE.  This is currently set at 2^31-1
but could be auto-configured if that ever proves necessary.  Also fix
some outright bugs like calling srand() where srandom() is appropriate.
This commit is contained in:
Tom Lane
2000-08-07 00:51:42 +00:00
parent 259489bab7
commit 9426047021
8 changed files with 47 additions and 25 deletions

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.158 2000/07/28 02:13:26 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.159 2000/08/07 00:51:30 tgl Exp $
*
* NOTES
*
@@ -1850,7 +1850,7 @@ DoBackend(Port *port)
*/
random_seed = 0;
gettimeofday(&now, &tz);
srandom(now.tv_usec);
srandom((unsigned int) now.tv_usec);
/* ----------------
* Now, build the argv vector that will be given to PostgresMain.
@@ -2029,7 +2029,6 @@ RandomSalt(char *salt)
static long
PostmasterRandom(void)
{
static bool initialized = false;
if (!initialized)