[PATCH,HURD] Fix select timeout rounding

Samuel Thibault samuel.thibault@ens-lyon.org
Sun Aug 1 23:30:00 GMT 2010


Hello,

Select is supposed to wait until the timeout is expired.  When converted
to ms, it should thus be rounded up instead of down.

Samuel

2010-07-31  Samuel Thibault  <samuel.thibault@ens-lyon.org>

        * hurd/hurdselect.c (_hurd_select): Round timeout up instead of down
        when converting to ms.

diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 544eee9..a7228f0 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -52,7 +52,7 @@ _hurd_select (int nfds,
   int firstfd, lastfd;
   mach_msg_timeout_t to = (timeout != NULL ?
 			   (timeout->tv_sec * 1000 +
-			    timeout->tv_nsec / 1000000) :
+			    (timeout->tv_nsec + 999999) / 1000000) :
 			   0);
   struct
     {



More information about the Libc-alpha mailing list