mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-05 04:47:20 +02: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:
parent
c124e3649b
commit
b1aed95f52
@ -399,7 +399,6 @@ static void processCancelRequest(Port *port, void *pkt);
|
||||
static int initMasks(fd_set *rmask);
|
||||
static void report_fork_failure_to_client(Port *port, int errnum);
|
||||
static CAC_state canAcceptConnections(void);
|
||||
static long PostmasterRandom(void);
|
||||
static void RandomSalt(char *md5Salt);
|
||||
static void signal_child(pid_t pid, int signal);
|
||||
static bool SignalSomeChildren(int signal, int targets);
|
||||
@ -5077,7 +5076,7 @@ RandomSalt(char *md5Salt)
|
||||
/*
|
||||
* PostmasterRandom
|
||||
*/
|
||||
static long
|
||||
long
|
||||
PostmasterRandom(void)
|
||||
{
|
||||
/*
|
||||
|
@ -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,
|
||||
|
@ -48,6 +48,7 @@ extern const char *progname;
|
||||
|
||||
extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
|
||||
extern void ClosePostmasterPorts(bool am_syslogger);
|
||||
extern long PostmasterRandom(void);
|
||||
|
||||
extern int MaxLivePostmasterChildren(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user