diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-09-20 12:24:44 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-09-20 12:30:38 -0400 |
commit | b1aed95f52f5fea1366f4c4b3a46b5604c6ca1e3 (patch) | |
tree | f7c667de4598ae485e1973f0b441108134da9704 /src/backend/storage | |
parent | c124e3649b0423cd7abc3f81208d9c7e8a7e8a8a (diff) | |
download | postgresql-b1aed95f52f5fea1366f4c4b3a46b5604c6ca1e3.tar.gz postgresql-b1aed95f52f5fea1366f4c4b3a46b5604c6ca1e3.zip |
Use PostmasterRandom(), not random(), for DSM control segment ID.
Otherwise, every startup gets the same "random" value, which is
definitely not what was intended.
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/ipc/dsm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c index b82ae05e155..70422972095 100644 --- a/src/backend/storage/ipc/dsm.c +++ b/src/backend/storage/ipc/dsm.c @@ -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, |