diff --git a/libs/libc/tls/tls_alloc.c b/libs/libc/tls/tls_alloc.c index ea170a16cc..2630e7e415 100644 --- a/libs/libc/tls/tls_alloc.c +++ b/libs/libc/tls/tls_alloc.c @@ -66,9 +66,10 @@ int tls_alloc(void) */ ret = _SEM_WAIT(&tinfo->ta_tlssem); - if (ret < 0) + + if (ERROR == ret) { - ret = _SEM_ERRVAL(ret); + ret = -get_errno(); goto errout_with_errno; } diff --git a/libs/libc/tls/tls_free.c b/libs/libc/tls/tls_free.c index 9cbe4a4238..7455e08cb3 100644 --- a/libs/libc/tls/tls_free.c +++ b/libs/libc/tls/tls_free.c @@ -79,7 +79,7 @@ int tls_free(int tlsindex) } else { - ret = _SEM_ERRVAL(ret); + ret = -get_errno(); } }