summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2018-07-06 07:54:35 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2018-07-06 07:54:35 +0000
commitc4d52483ac1d9620210c7fdc04e1d7f3848f4a36 (patch)
tree81bd60c7b26d84f51cb39484ab9dfc10af3f1f0c
parent501d9b9662327a85aa738d362a100a420a5698b3 (diff)
Return EINVAL if pthread_barrier_init is called with count=0.
OK kettenis@, guenther@
-rw-r--r--lib/librthread/rthread_barrier.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/librthread/rthread_barrier.c b/lib/librthread/rthread_barrier.c
index 7ecdb1f4298..20a0b9ea221 100644
--- a/lib/librthread/rthread_barrier.c
+++ b/lib/librthread/rthread_barrier.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_barrier.c,v 1.3 2016/04/15 17:54:17 tedu Exp $ */
+/* $OpenBSD: rthread_barrier.c,v 1.4 2018/07/06 07:54:34 pirofti Exp $ */
/*
* Copyright (c) 2012 Paul Irofti <pirofti@openbsd.org>
*
@@ -31,6 +31,9 @@ pthread_barrier_init(pthread_barrier_t *barrier, pthread_barrierattr_t *attr,
if (barrier == NULL)
return (EINVAL);
+ if (count == 0)
+ return (EINVAL);
+
if (attr != NULL) {
if (*attr == NULL)
return (EINVAL);