aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-10-01 01:44:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2020-10-01 01:44:26 +0200
commitaaa0709e7b39d0dc22ac92443a86c84eaff58679 (patch)
tree40504c5faddf67136d385b922b1462b0bbd50755 /libbb/appletlib.c
parent841878e7eeb8861aa1b6f94436b8dcf3b064d1e4 (diff)
downloadbusybox-aaa0709e7b39d0dc22ac92443a86c84eaff58679.tar.gz
libbb: do not open-code __errno_location() call
Thanks dalias! Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/appletlib.c')
-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 @@
*
* FEATURE_INSTALLER or FEATURE_SUID will still link printf routines in. :(
*/
+
+/* Define this accessor before we #define "errno" our way */
+#include <errno.h>
+static inline int *get_perrno(void) { return &errno; }
+
#include "busybox.h"
#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
@@ -304,7 +309,7 @@ void lbb_prepare(const char *applet
IF_FEATURE_INDIVIDUAL(, char **argv))
{
#ifdef bb_cached_errno_ptr
- (*(int **)not_const_pp(&bb_errno)) = __errno_location();
+ (*(int **)not_const_pp(&bb_errno)) = get_perrno();
barrier();
#endif
applet_name = applet;