diff --git a/lib/libkse/thread/thr_join.c b/lib/libkse/thread/thr_join.c index 1a3452e6e374..554c5c6099a8 100644 --- a/lib/libkse/thread/thr_join.c +++ b/lib/libkse/thread/thr_join.c @@ -80,7 +80,7 @@ _pthread_join(pthread_t pthread, void **thread_return) THR_SCHED_UNLOCK(curthread, pthread); /* Remove the reference and return an error: */ _thr_ref_delete(curthread, pthread); - ret = ESRCH; + ret = EINVAL; } else { /* Lock the target thread while checking its state. */ if (pthread->state == PS_DEAD) { diff --git a/lib/libpthread/thread/thr_join.c b/lib/libpthread/thread/thr_join.c index 1a3452e6e374..554c5c6099a8 100644 --- a/lib/libpthread/thread/thr_join.c +++ b/lib/libpthread/thread/thr_join.c @@ -80,7 +80,7 @@ _pthread_join(pthread_t pthread, void **thread_return) THR_SCHED_UNLOCK(curthread, pthread); /* Remove the reference and return an error: */ _thr_ref_delete(curthread, pthread); - ret = ESRCH; + ret = EINVAL; } else { /* Lock the target thread while checking its state. */ if (pthread->state == PS_DEAD) { diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c index 92a3b6222e69..139c74c7925c 100644 --- a/lib/libthr/thread/thr_join.c +++ b/lib/libthr/thread/thr_join.c @@ -88,7 +88,7 @@ join_common(pthread_t pthread, void **thread_return, if ((ret = _thr_find_thread(curthread, pthread, 1)) != 0) { ret = ESRCH; } else if ((pthread->tlflags & TLFLAGS_DETACHED) != 0) { - ret = ESRCH; + ret = EINVAL; } else if (pthread->joiner != NULL) { /* Multiple joiners are not supported. */ ret = ENOTSUP;