From 8e6cdd0375c8e994da592a85064c0b669840e80c Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 28 Jan 2021 17:03:22 +0800 Subject: [PATCH] pthread: Return get_errno instead the hardcode value Signed-off-by: Xiang Xiao Change-Id: I1830a473da179d3a1280d3482b0f000ce72de107 --- libs/libc/pthread/pthread_barrierwait.c | 2 +- libs/libc/pthread/pthread_conddestroy.c | 2 +- libs/libc/pthread/pthread_condinit.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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 {