diff --git a/libs/libc/pthread/pthread_barrierwait.c b/libs/libc/pthread/pthread_barrierwait.c index adece0c909c..fc3d26fd6b7 100644 --- a/libs/libc/pthread/pthread_barrierwait.c +++ b/libs/libc/pthread/pthread_barrierwait.c @@ -113,7 +113,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier) if (ret != OK) { sched_unlock(); - return EINVAL; + return get_errno(); } /* If the number of waiters would be equal to the count, then we are done */ diff --git a/libs/libc/pthread/pthread_conddestroy.c b/libs/libc/pthread/pthread_conddestroy.c index 7619580c5d9..d23113bf558 100644 --- a/libs/libc/pthread/pthread_conddestroy.c +++ b/libs/libc/pthread/pthread_conddestroy.c @@ -95,7 +95,7 @@ int pthread_cond_destroy(FAR pthread_cond_t *cond) } else if (sem_destroy(&cond->sem) != OK) { - ret = EINVAL; + ret = get_errno(); } } } diff --git a/libs/libc/pthread/pthread_condinit.c b/libs/libc/pthread/pthread_condinit.c index bce0e3584b0..fdf5d904acd 100644 --- a/libs/libc/pthread/pthread_condinit.c +++ b/libs/libc/pthread/pthread_condinit.c @@ -80,9 +80,9 @@ int pthread_cond_init(FAR pthread_cond_t *cond, * initial count = 0 */ - else if (sem_init((FAR sem_t *)&cond->sem, 0, 0) != OK) + else if (sem_init(&cond->sem, 0, 0) != OK) { - ret = EINVAL; + ret = get_errno(); } else {