Skip to content

Commit 15e9457

Browse files
committed
Fix uninitialized-variable bug.
For some reason, neither of the compilers I usually use noticed the uninitialized-variable problem I introduced in commit 7e2a18a. That's hardly a good enough excuse though. Committing with brown paper bag on head. In addition to putting the operations in the right order, move the declaration of "now" inside the loop; there's no need for it to be outside, and that does wake up older gcc enough to notice any similar future problem. Back-patch to 9.4; earlier versions lack the time-to-SIGKILL stanza so there's no bug.
1 parent 56f9d91 commit 15e9457

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,8 +1596,7 @@ ServerLoop(void)
15961596
{
15971597
fd_set readmask;
15981598
int nSockets;
1599-
time_t now,
1600-
last_lockfile_recheck_time,
1599+
time_t last_lockfile_recheck_time,
16011600
last_touch_time;
16021601

16031602
last_lockfile_recheck_time = last_touch_time = time(NULL);
@@ -1608,6 +1607,7 @@ ServerLoop(void)
16081607
{
16091608
fd_set rmask;
16101609
int selres;
1610+
time_t now;
16111611

16121612
/*
16131613
* Wait for a connection request to arrive.
@@ -1759,6 +1759,16 @@ ServerLoop(void)
17591759
Assert(pthread_is_threaded_np() == 0);
17601760
#endif
17611761

1762+
/*
1763+
* Lastly, check to see if it's time to do some things that we don't
1764+
* want to do every single time through the loop, because they're a
1765+
* bit expensive. Note that there's up to a minute of slop in when
1766+
* these tasks will be performed, since DetermineSleepTime() will let
1767+
* us sleep at most that long; except for SIGKILL timeout which has
1768+
* special-case logic there.
1769+
*/
1770+
now = time(NULL);
1771+
17621772
/*
17631773
* If we already sent SIGQUIT to children and they are slow to shut
17641774
* down, it's time to send them SIGKILL. This doesn't happen
@@ -1777,15 +1787,6 @@ ServerLoop(void)
17771787
AbortStartTime = 0;
17781788
}
17791789

1780-
/*
1781-
* Lastly, check to see if it's time to do some things that we don't
1782-
* want to do every single time through the loop, because they're a
1783-
* bit expensive. Note that there's up to a minute of slop in when
1784-
* these tasks will be performed, since DetermineSleepTime() will let
1785-
* us sleep at most that long.
1786-
*/
1787-
now = time(NULL);
1788-
17891790
/*
17901791
* Once a minute, verify that postmaster.pid hasn't been removed or
17911792
* overwritten. If it has, we force a shutdown. This avoids having

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