public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Vineet Gupta <vgupta@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/vineet/arc-port-latest] hurd: fix usleep(ULONG_MAX)
Date: Tue,  7 Jul 2020 22:04:05 +0000 (GMT)	[thread overview]
Message-ID: <20200707220405.6E2B33861024@sourceware.org> (raw)

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;


                 reply	other threads:[~2020-07-07 22:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200707220405.6E2B33861024@sourceware.org \
    --to=vgupta@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).