From 495300037094f5cd354ae677f7d7107b2c72dc90 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 4 May 2023 04:59:19 +0300 Subject: [PATCH] Workaround for errno --- libc/include/errno.h | 2 +- libc/src/std/errno.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libc/include/errno.h b/libc/include/errno.h index 4185ae7..a1ac400 100644 --- a/libc/include/errno.h +++ b/libc/include/errno.h @@ -131,7 +131,7 @@ #define EOWNERDEAD 130 /* Owner died */ #define ENOTRECOVERABLE 131 /* State not recoverable */ -extern int *__errno_location(void) __attribute__((const)); +extern int *__errno_location(void) __attribute__((const)) __attribute__ ((__nothrow__)); #define errno (*__errno_location()) #endif diff --git a/libc/src/std/errno.c b/libc/src/std/errno.c index 88f8478..017da8a 100644 --- a/libc/src/std/errno.c +++ b/libc/src/std/errno.c @@ -1,6 +1,8 @@ #include +int __local_stub_errno = 0; + int *__errno_location(void) { - return 0; -} \ No newline at end of file + return &__local_stub_errno; +}