Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+3-1
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)