Content-Length: 266773 | pFad | http://github.com/postgrespro/postgres/commit/f0ee42d59b797603d645df8876ae3abf6d016f1e

26 Fix unportable coding in DetermineSleepTime(). · postgrespro/postgres@f0ee42d · GitHub
Skip to content

Commit f0ee42d

Browse files
committed
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.
1 parent 60ff2fd commit f0ee42d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,10 +1462,12 @@ DetermineSleepTime(struct timeval * timeout)
14621462

14631463
if (next_wakeup != 0)
14641464
{
1465+
long secs;
14651466
int microsecs;
14661467

14671468
TimestampDifference(GetCurrentTimestamp(), next_wakeup,
1468-
&timeout->tv_sec, &microsecs);
1469+
&secs, &microsecs);
1470+
timeout->tv_sec = secs;
14691471
timeout->tv_usec = microsecs;
14701472

14711473
/* Ensure we don't exceed one minute */

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/f0ee42d59b797603d645df8876ae3abf6d016f1e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy