aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-28 22:39:03 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-28 22:39:03 +0000
commit1f3413338e31e65f2927aef02c151745d3b899d0 (patch)
tree941e18caaf9e867d7599d234928bdf072e51acf7 /sysdeps
parent3c9f67e7a58487c084f3b657c1dfe490d1a318d5 (diff)
downloadglibc-1f3413338e31e65f2927aef02c151745d3b899d0.tar
glibc-1f3413338e31e65f2927aef02c151745d3b899d0.tar.gz
glibc-1f3413338e31e65f2927aef02c151745d3b899d0.tar.bz2
glibc-1f3413338e31e65f2927aef02c151745d3b899d0.zip
hurd: fix usleep(ULONG_MAX)
* sysdeps/mach/usleep.c (usleep): Clamp timeout when rouding up.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/usleep.c6
1 files changed, 5 insertions, 1 deletions
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;