summaryrefslogtreecommitdiff
path: root/sysdeps/generic/pt-cond-timedwait.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/pt-cond-timedwait.c')
-rw-r--r--sysdeps/generic/pt-cond-timedwait.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sysdeps/generic/pt-cond-timedwait.c b/sysdeps/generic/pt-cond-timedwait.c
index 4abeb71c..c10bdb30 100644
--- a/sysdeps/generic/pt-cond-timedwait.c
+++ b/sysdeps/generic/pt-cond-timedwait.c
@@ -1,5 +1,5 @@
/* Wait on a condition. Generic version.
- Copyright (C) 2000,02 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2005 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
@@ -58,6 +58,9 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond,
__pthread_mutex_lock (mutex);
}
+ if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000))
+ return EINVAL;
+
struct __pthread *self = _pthread_self ();
/* Add ourselves to the list of waiters. */
@@ -74,8 +77,6 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond,
if (abstime)
{
- error_t err;
-
err = __pthread_timedblock (self, abstime);
if (err)
/* We timed out. We may need to disconnect ourself from the
@@ -91,8 +92,6 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond,
if (self->prevp)
__pthread_dequeue (self);
__pthread_spin_unlock (&mutex->__lock);
-
- return err;
}
}
else