summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2024-01-10 04:28:44 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2024-01-10 04:28:44 +0000
commitccf6f7c156ae132b44b31de81c6034eb7a6fcd8e (patch)
tree604e63b41091f350f5e13c1fa7ecf582d4271540 /lib
parentf078343c00dde60ef10e860956d2cc3ed5c5d295 (diff)
pthread_cond_timedwait(3): accept negative absolute timeouts
Negative absolute timeouts are valid inputs. With input from kettenis@. Thread: https://marc.info/?l=openbsd-tech&m=170467558006767&w=2 ok guenther@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/thread/rthread_cond.c5
-rw-r--r--lib/libc/thread/rthread_sync.c4
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/thread/rthread_cond.c b/lib/libc/thread/rthread_cond.c
index 51e9f4f9967..fde4b524fe4 100644
--- a/lib/libc/thread/rthread_cond.c
+++ b/lib/libc/thread/rthread_cond.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_cond.c,v 1.5 2019/01/29 17:40:26 mpi Exp $ */
+/* $OpenBSD: rthread_cond.c,v 1.6 2024/01/10 04:28:43 cheloha Exp $ */
/*
* Copyright (c) 2017 Martin Pieuchot <mpi@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -142,8 +142,7 @@ pthread_cond_timedwait(pthread_cond_t *condp, pthread_mutex_t *mutexp,
}
cond = *condp;
- if (abs == NULL || abs->tv_sec < 0 || abs->tv_nsec < 0 ||
- abs->tv_nsec >= 1000000000)
+ if (abs == NULL || abs->tv_nsec < 0 || abs->tv_nsec >= 1000000000)
return (EINVAL);
return (_rthread_cond_timedwait(cond, mutexp, abs));
diff --git a/lib/libc/thread/rthread_sync.c b/lib/libc/thread/rthread_sync.c
index 42e1a7ee737..3a9d2d0d647 100644
--- a/lib/libc/thread/rthread_sync.c
+++ b/lib/libc/thread/rthread_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_sync.c,v 1.5 2018/04/24 16:28:42 pirofti Exp $ */
+/* $OpenBSD: rthread_sync.c,v 1.6 2024/01/10 04:28:43 cheloha Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2012 Philip Guenther <guenther@openbsd.org>
@@ -317,7 +317,7 @@ pthread_cond_timedwait(pthread_cond_t *condp, pthread_mutex_t *mutexp,
abort();
}
- if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 ||
+ if (abstime == NULL || abstime->tv_nsec < 0 ||
abstime->tv_nsec >= 1000000000)
return (EINVAL);