From c4d52483ac1d9620210c7fdc04e1d7f3848f4a36 Mon Sep 17 00:00:00 2001 From: Paul Irofti Date: Fri, 6 Jul 2018 07:54:35 +0000 Subject: Return EINVAL if pthread_barrier_init is called with count=0. OK kettenis@, guenther@ --- lib/librthread/rthread_barrier.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 * @@ -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); -- cgit v1.2.3