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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy