• Heikki Linnakangas's avatar
    Increase the number of different values used when seeding random(). · 98c50656
    Heikki Linnakangas authored
    When a backend process is forked, we initialize the system's random number
    generator with srandom(). The seed used is derived from the backend's pid
    and the timestamp. However, we only used the microseconds part of the
    timestamp, and it was XORed with the pid, so the total range of different
    seed values chosen was 0-999999. That's quite limited.
    
    Change the code to also use the seconds part of the timestamp in the seed,
    and shift the microseconds so that all 32 bits of the seed are used.
    
    Honza Horak
    98c50656
postmaster.c 163 KB