From 4da144c09175b4cc1b1dae4081c0840ef2739819 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 12 Jul 2000 22:46:40 +0000 Subject: [PATCH] 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. --- sys/kern/sys_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 7489e0ebaace..6099c0bcf059 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -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;