summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Munro2018-11-15 04:10:43 +0000
committerThomas Munro2018-11-15 04:38:55 +0000
commitab8984f52d9b99234d23e6fb7b73cf4c12b3ac14 (patch)
tree7bd993576a8fb39867c6a10cdc9f6a0e8be0a4f8 /src
parent5b0ce3ec334bb65bbab4aba78f204f986c356e80 (diff)
Further adjustment to random() seed initialization.
Per complaint from Tom Lane, don't chomp the timestamp at 32 bits, so we can shift in some of its higher bits. Discussion: https://postgr.es/m/14712.1542253115%40sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/postmaster.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 981a058522f..cb49f3255f9 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2532,9 +2532,9 @@ InitProcessGlobals(void)
* in a given time period. Since that would leave only 20 bits of the
* timestamp that cycle every ~1 second, also mix in some higher bits.
*/
- srandom(((unsigned int) MyProcPid) ^
- ((unsigned int) MyStartTimestamp << 12) ^
- ((unsigned int) MyStartTimestamp >> 20));
+ srandom(((uint64) MyProcPid) ^
+ ((uint64) MyStartTimestamp << 12) ^
+ ((uint64) MyStartTimestamp >> 20));
}