Fix a very obscure bug in select() and poll() where the timeout would
never expire if poll() or select() was called before the system had been in multiuser for 1 second. This was caused by only checking to see if tv_sec was zero rather than checking both tv_sec and tv_usec.
This commit is contained in:
parent
7d20010979
commit
4da144c091
@ -703,7 +703,7 @@ retry:
|
||||
error = selscan(p, ibits, obits, uap->nd);
|
||||
if (error || p->p_retval[0])
|
||||
goto done;
|
||||
if (atv.tv_sec) {
|
||||
if (atv.tv_sec || atv.tv_usec) {
|
||||
getmicrouptime(&rtv);
|
||||
if (timevalcmp(&rtv, &atv, >=))
|
||||
goto done;
|
||||
@ -836,7 +836,7 @@ retry:
|
||||
error = pollscan(p, (struct pollfd *)bits, SCARG(uap, nfds));
|
||||
if (error || p->p_retval[0])
|
||||
goto done;
|
||||
if (atv.tv_sec) {
|
||||
if (atv.tv_sec || atv.tv_usec) {
|
||||
getmicrouptime(&rtv);
|
||||
if (timevalcmp(&rtv, &atv, >=))
|
||||
goto done;
|
||||
|
Loading…
x
Reference in New Issue
Block a user