aboutsummaryrefslogtreecommitdiff
path: root/applets/applets.c
diff options
context:
space:
mode:
Diffstat (limited to 'applets/applets.c')
-rw-r--r--applets/applets.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/applets/applets.c b/applets/applets.c
index e905ebec4..bd3704394 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -641,10 +641,19 @@ void run_applet_and_exit(const char *name, char **argv)
}
+#ifdef __GLIBC__
+/* Make it reside in R/W memory: */
+int *const bb_errno __attribute__ ((section (".data")));
+#endif
+
int main(int argc, char **argv)
{
const char *s;
+#ifdef __GLIBC__
+ (*(int **)&bb_errno) = __errno_location();
+#endif
+
#if !BB_MMU
/* NOMMU re-exec trick sets high-order bit in first byte of name */
if (argv[0][0] & 0x80) {