diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-02-15 17:09:50 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-02-15 17:09:50 -0500 |
commit | f0ee42d59b797603d645df8876ae3abf6d016f1e (patch) | |
tree | 92060c731fd86d0fe34c3e82139715ec5931bceb /src | |
parent | 60ff2fdd9970ba29f5267317a5e7354d2658c1e5 (diff) | |
download | postgresql-f0ee42d59b797603d645df8876ae3abf6d016f1e.tar.gz postgresql-f0ee42d59b797603d645df8876ae3abf6d016f1e.zip |
Fix unportable coding in DetermineSleepTime().
We should not assume that struct timeval.tv_sec is a long, because
it ain't necessarily. (POSIX says that it's a time_t, which might
well be 64 bits now or in the future; or for that matter might be
32 bits on machines with 64-bit longs.) Per buildfarm member panther.
Back-patch to 9.3 where the dubious coding was introduced.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 6bb2a474857..b7f99fc18d3 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -1462,10 +1462,12 @@ DetermineSleepTime(struct timeval * timeout) if (next_wakeup != 0) { + long secs; int microsecs; TimestampDifference(GetCurrentTimestamp(), next_wakeup, - &timeout->tv_sec, µsecs); + &secs, µsecs); + timeout->tv_sec = secs; timeout->tv_usec = microsecs; /* Ensure we don't exceed one minute */ |