aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/clock_settime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index daee2e2..36bd98f 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -31,6 +31,13 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
struct timeval tv;
int retval;
+ /* Make sure the time cvalue is OK. */
+ if (tp->tv_nsec < 0 || tp->tv_nsec >= 1000000000)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
switch (clock_id)
{
case CLOCK_REALTIME: