public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/vineet/arc-port-latest] hurd: fix usleep(ULONG_MAX)
@ 2020-07-07 22:04 Vineet Gupta
  0 siblings, 0 replies; only message in thread
From: Vineet Gupta @ 2020-07-07 22:04 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1f3413338e31e65f2927aef02c151745d3b899d0

commit 1f3413338e31e65f2927aef02c151745d3b899d0
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Jun 28 22:39:03 2020 +0000

    hurd: fix usleep(ULONG_MAX)
    
    * sysdeps/mach/usleep.c (usleep): Clamp timeout when rouding up.

Diff:
---
 sysdeps/mach/usleep.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sysdeps/mach/usleep.c b/sysdeps/mach/usleep.c
index 530336ba0b..d53eb04a51 100644
--- a/sysdeps/mach/usleep.c
+++ b/sysdeps/mach/usleep.c
@@ -25,11 +25,15 @@ int
 usleep (useconds_t useconds)
 {
   mach_port_t recv;
+  useconds_t useconds_up = useconds + 999;
+
+  if (useconds_up < useconds)
+    useconds_up = UINT32_MAX;
 
   recv = __mach_reply_port ();
 
   (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
-		     0, 0, recv, (useconds + 999) / 1000, MACH_PORT_NULL);
+		     0, 0, recv, useconds_up / 1000, MACH_PORT_NULL);
   __mach_port_destroy (mach_task_self (), recv);
 
   return 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-07 22:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 22:04 [glibc/vineet/arc-port-latest] hurd: fix usleep(ULONG_MAX) Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).