summaryrefslogtreecommitdiff
path: root/components/libc/posix
diff options
context:
space:
mode:
authorliuxianliang <[email protected]>2022-05-13 10:41:09 +0800
committerguo <[email protected]>2022-05-18 08:44:30 +0800
commit6dd6929b8e6981e1fc44cd75fedb63365d7ef36c (patch)
treea348e788d0fe444caafa7daa90fc4ff1708b0172 /components/libc/posix
parent75a55f2028b9b1d82b0e479c9325ac4184687922 (diff)
[fix] return "EINVAL" if "count" is zero.
Diffstat (limited to 'components/libc/posix')
-rw-r--r--components/libc/posix/pthreads/pthread_barrier.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/components/libc/posix/pthreads/pthread_barrier.c b/components/libc/posix/pthreads/pthread_barrier.c
index 1a5b7fa3f9..bebd25a455 100644
--- a/components/libc/posix/pthreads/pthread_barrier.c
+++ b/components/libc/posix/pthreads/pthread_barrier.c
@@ -72,6 +72,8 @@ int pthread_barrier_init(pthread_barrier_t *barrier,
return EINVAL;
if (attr && (*attr != PTHREAD_PROCESS_PRIVATE))
return EINVAL;
+ if (count == 0)
+ return EINVAL;
barrier->count = count;
pthread_cond_init(&(barrier->cond), NULL);