alias basename to glibc name for it, to meet abi goals
[musl] / src / errno / __errno_location.c
index 0a220b6..3e92d7c 100644 (file)
@@ -1,11 +1,8 @@
-#include <errno.h>
-#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;
 }