Fix potential NULL pointer access in timer code.

https://bugzilla.novell.com/show_bug.cgi?id=223718
This commit is contained in:
Matthias Hopf 2006-11-28 18:57:13 +01:00
parent 5dbcd34a0a
commit 834e4b0798

View File

@ -205,15 +205,17 @@ WaitForSomething(int *pClientsReady)
if (timeout > 0 && timeout > timers->delta + 250) {
/* time has rewound. reset the timers. */
CheckAllTimers(now);
timeout = timers->expires - now;
}
if (timeout < 0)
timeout = 0;
waittime.tv_sec = timeout / MILLI_PER_SECOND;
waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
(1000000 / MILLI_PER_SECOND);
wt = &waittime;
if (timers) {
timeout = timers->expires - now;
if (timeout < 0)
timeout = 0;
waittime.tv_sec = timeout / MILLI_PER_SECOND;
waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
(1000000 / MILLI_PER_SECOND);
wt = &waittime;
}
}
XFD_COPYSET(&AllSockets, &LastSelectMask);
#ifdef SMART_SCHEDULE