summaryrefslogtreecommitdiff
path: root/lib/libc/errno/errno.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/errno/errno.c')
-rw-r--r--lib/libc/errno/errno.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/errno/errno.c b/lib/libc/errno/errno.c
index 55423e22..09b22f4d 100644
--- a/lib/libc/errno/errno.c
+++ b/lib/libc/errno/errno.c
@@ -1,8 +1,7 @@
-// TODO: Should return the address of the calling thread's `errno` storage.
-// Currently, this is a stub implementation that returns the address of a
-// static variable.
+#include <__thread.h>
+#include <threads.h>
+
int *__errno(void)
{
- static int __thread_errno = 0;
- return &__thread_errno;
+ return &thrd_current()->terrno;
}