summaryrefslogtreecommitdiff
path: root/sysdeps/htl/sem-timedwait.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/htl/sem-timedwait.c')
-rw-r--r--sysdeps/htl/sem-timedwait.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sysdeps/htl/sem-timedwait.c b/sysdeps/htl/sem-timedwait.c
index 803a5c04f4..dfb0cb99d3 100644
--- a/sysdeps/htl/sem-timedwait.c
+++ b/sysdeps/htl/sem-timedwait.c
@@ -1,5 +1,5 @@
/* Wait on a semaphore with a timeout. Generic version.
- Copyright (C) 2005-2018 Free Software Foundation, Inc.
+ Copyright (C) 2005-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,11 +14,12 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <semaphore.h>
#include <errno.h>
#include <assert.h>
+#include <time.h>
#include <pt-internal.h>
@@ -39,7 +40,7 @@ __sem_timedwait_internal (sem_t *restrict sem,
return 0;
}
- if (timeout != NULL && (timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000))
+ if (timeout != NULL && ! valid_nanoseconds (timeout->tv_nsec))
{
errno = EINVAL;
return -1;