Fix uninitialized-variable bug.
For some reason, neither of the compilers I usually use noticed the uninitialized-variable problem I introduced in commit 7e2a18a9161fee7e. 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.
This commit is contained in:
parent
41562b14bb
commit
94f5246ce1
@ -1601,8 +1601,7 @@ ServerLoop(void)
|
|||||||
{
|
{
|
||||||
fd_set readmask;
|
fd_set readmask;
|
||||||
int nSockets;
|
int nSockets;
|
||||||
time_t now,
|
time_t last_lockfile_recheck_time,
|
||||||
last_lockfile_recheck_time,
|
|
||||||
last_touch_time;
|
last_touch_time;
|
||||||
|
|
||||||
last_lockfile_recheck_time = last_touch_time = time(NULL);
|
last_lockfile_recheck_time = last_touch_time = time(NULL);
|
||||||
@ -1613,6 +1612,7 @@ ServerLoop(void)
|
|||||||
{
|
{
|
||||||
fd_set rmask;
|
fd_set rmask;
|
||||||
int selres;
|
int selres;
|
||||||
|
time_t now;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for a connection request to arrive.
|
* Wait for a connection request to arrive.
|
||||||
@ -1764,6 +1764,16 @@ ServerLoop(void)
|
|||||||
Assert(pthread_is_threaded_np() == 0);
|
Assert(pthread_is_threaded_np() == 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lastly, check to see if it's time to do some things that we don't
|
||||||
|
* want to do every single time through the loop, because they're a
|
||||||
|
* bit expensive. Note that there's up to a minute of slop in when
|
||||||
|
* these tasks will be performed, since DetermineSleepTime() will let
|
||||||
|
* us sleep at most that long; except for SIGKILL timeout which has
|
||||||
|
* special-case logic there.
|
||||||
|
*/
|
||||||
|
now = time(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we already sent SIGQUIT to children and they are slow to shut
|
* If we already sent SIGQUIT to children and they are slow to shut
|
||||||
* down, it's time to send them SIGKILL. This doesn't happen
|
* down, it's time to send them SIGKILL. This doesn't happen
|
||||||
@ -1782,15 +1792,6 @@ ServerLoop(void)
|
|||||||
AbortStartTime = 0;
|
AbortStartTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Lastly, check to see if it's time to do some things that we don't
|
|
||||||
* want to do every single time through the loop, because they're a
|
|
||||||
* bit expensive. Note that there's up to a minute of slop in when
|
|
||||||
* these tasks will be performed, since DetermineSleepTime() will let
|
|
||||||
* us sleep at most that long.
|
|
||||||
*/
|
|
||||||
now = time(NULL);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Once a minute, verify that postmaster.pid hasn't been removed or
|
* Once a minute, verify that postmaster.pid hasn't been removed or
|
||||||
* overwritten. If it has, we force a shutdown. This avoids having
|
* overwritten. If it has, we force a shutdown. This avoids having
|
||||||
|
Loading…
x
Reference in New Issue
Block a user