X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ferrno%2F__errno_location.c;h=3e92d7c7a89abc6e10c31ff3e600bfa2e987fe28;hb=743546a9339d3da4304fd63f74872e90ac792f63;hp=0a220b6383a6d1ff547164c34c075b4614cd65c7;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/errno/__errno_location.c b/src/errno/__errno_location.c index 0a220b63..3e92d7c7 100644 --- a/src/errno/__errno_location.c +++ b/src/errno/__errno_location.c @@ -1,11 +1,8 @@ -#include -#include "libc.h" - -#undef errno -int errno; +#include "pthread_impl.h" int *__errno_location(void) { - if (libc.errno_location) return libc.errno_location(); - return &errno; + static int e; + if (libc.main_thread) return __pthread_self()->errno_ptr; + return &e; }