mirror of https://github.com/Icinga/icinga2.git
Bugfix: Make sure timeval is valid.
This commit is contained in:
parent
8621717f4c
commit
fd64dc5a99
|
@ -79,13 +79,15 @@ void Application::RunEventLoop(void)
|
||||||
nfds = fd;
|
nfds = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
long sleep = (long)(Timer::GetNextCall() - time(NULL));
|
time_t now = time(NULL);
|
||||||
|
time_t next = Timer::GetNextCall();
|
||||||
|
long sleep = (next < now) ? 0 : (next - now);
|
||||||
|
|
||||||
if (m_ShuttingDown)
|
if (m_ShuttingDown)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
timeval tv;
|
timeval tv;
|
||||||
tv.tv_sec = sleep;
|
tv.tv_sec = (sleep < 0) ? 0 : sleep;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
int ready;
|
int ready;
|
||||||
|
|
Loading…
Reference in New Issue