X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_barrier_init.c;h=4c3cb28d44c36b04fe6f136af47952fb4840e311;hp=2cc67ed5afd41883fe9375cc0f016e244a454c89;hb=HEAD;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 diff --git a/src/thread/pthread_barrier_init.c b/src/thread/pthread_barrier_init.c index 2cc67ed5..4c3cb28d 100644 --- a/src/thread/pthread_barrier_init.c +++ b/src/thread/pthread_barrier_init.c @@ -1,8 +1,8 @@ #include "pthread_impl.h" -int pthread_barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *a, unsigned count) +int pthread_barrier_init(pthread_barrier_t *restrict b, const pthread_barrierattr_t *restrict a, unsigned count) { - if (!count) return EINVAL; - *b = (pthread_barrier_t){ .__limit = count-1 }; + if (count-1 > INT_MAX-1) return EINVAL; + *b = (pthread_barrier_t){ ._b_limit = count-1 | (a?a->__attr:0) }; return 0; }