aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 83ecca47f..df7e45404 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -339,12 +339,13 @@ struct BUG_off_t_size_is_misdetected {
#endif
#endif
-#if defined(__GLIBC__)
-/* glibc uses __errno_location() to get a ptr to errno */
-/* We can just memorize it once - no multithreading in busybox :) */
+#if defined(errno)
+/* If errno is a define, assume it's "define errno (*__errno_location())"
+ * and we will cache it's result in this variable */
extern int *const bb_errno;
#undef errno
#define errno (*bb_errno)
+#define bb_cached_errno_ptr 1
#endif
#if !(ULONG_MAX > 0xffffffff)