Re: pthread_barrier_init: check count argument

2018-07-05 Thread Philip Guenther
On Thu, Jul 5, 2018 at 1:20 AM Paul Irofti  wrote:

> POSIX mandates that we return EINVAL if count equals zero on barrier
> initialization. Which makes sense to me.
>
> This also fixes posixtestsuite conformance 3-1 test.
>
> OK?
>

ok guenther@


pthread_barrier_init: check count argument

2018-07-05 Thread Paul Irofti
Hi,

POSIX mandates that we return EINVAL if count equals zero on barrier
initialization. Which makes sense to me.

This also fixes posixtestsuite conformance 3-1 test.

OK?


Index: rthread_barrier.c
===
RCS file: /cvs/src/lib/librthread/rthread_barrier.c,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 rthread_barrier.c
--- rthread_barrier.c   15 Apr 2016 17:54:17 -  1.3
+++ rthread_barrier.c   5 Jul 2018 10:16:44 -
@@ -31,6 +31,9 @@ pthread_barrier_init(pthread_barrier_t *
if (barrier == NULL)
return (EINVAL);
 
+   if (count == 0)
+   return(EINVAL);
+
if (attr != NULL) {
if (*attr == NULL)
return (EINVAL);