1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Use PostmasterRandom(), not random(), for DSM control segment ID.

Otherwise, every startup gets the same "random" value, which is
definitely not what was intended.
This commit is contained in:
Robert Haas
2016-09-20 12:24:44 -04:00
parent 419113dfdc
commit 470d886c32
3 changed files with 4 additions and 3 deletions

View File

@@ -36,6 +36,7 @@
#include "lib/ilist.h"
#include "miscadmin.h"
#include "postmaster/postmaster.h"
#include "storage/dsm.h"
#include "storage/ipc.h"
#include "storage/lwlock.h"
@@ -181,7 +182,7 @@ dsm_postmaster_startup(PGShmemHeader *shim)
{
Assert(dsm_control_address == NULL);
Assert(dsm_control_mapped_size == 0);
dsm_control_handle = random();
dsm_control_handle = (dsm_handle) PostmasterRandom();
if (dsm_control_handle == 0)
continue;
if (dsm_impl_op(DSM_OP_CREATE, dsm_control_handle, segsize,