aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/appletlib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 717c63649..5f59f1273 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -25,6 +25,11 @@
25 * 25 *
26 * FEATURE_INSTALLER or FEATURE_SUID will still link printf routines in. :( 26 * FEATURE_INSTALLER or FEATURE_SUID will still link printf routines in. :(
27 */ 27 */
28
29/* Define this accessor before we #define "errno" our way */
30#include <errno.h>
31static inline int *get_perrno(void) { return &errno; }
32
28#include "busybox.h" 33#include "busybox.h"
29 34
30#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ 35#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
@@ -304,7 +309,7 @@ void lbb_prepare(const char *applet
304 IF_FEATURE_INDIVIDUAL(, char **argv)) 309 IF_FEATURE_INDIVIDUAL(, char **argv))
305{ 310{
306#ifdef bb_cached_errno_ptr 311#ifdef bb_cached_errno_ptr
307 (*(int **)not_const_pp(&bb_errno)) = __errno_location(); 312 (*(int **)not_const_pp(&bb_errno)) = get_perrno();
308 barrier(); 313 barrier();
309#endif 314#endif
310 applet_name = applet; 315 applet_name = applet;