1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +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 c124e3649b
commit b1aed95f52
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"
@@ -179,7 +180,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,