Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dada474

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 38855be commit dada474

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
@@ -1478,10 +1478,12 @@ DetermineSleepTime(struct timeval * timeout)
14781478

14791479
if (next_wakeup != 0)
14801480
{
1481+
long secs;
14811482
int microsecs;
14821483

14831484
TimestampDifference(GetCurrentTimestamp(), next_wakeup,
1484-
&timeout->tv_sec, &microsecs);
1485+
&secs, &microsecs);
1486+
timeout->tv_sec = secs;
14851487
timeout->tv_usec = microsecs;
14861488

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

0 commit comments

Comments
 (0)