summaryrefslogtreecommitdiffstats
path: root/libc/stdlib
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-09-08 02:29:37 +0000
committerMike Frysinger <vapier@gentoo.org>2005-09-08 02:29:37 +0000
commit073cd03a2c5b0eb6c0872622f840f4a9724a9b04 (patch)
tree4a88ed2b1501a63d036a9d928e08e9841c8b414f /libc/stdlib
parentee11fb2608a02a6563bc38dc1bc38510fcc0ab9e (diff)
downloaduClibc-alpine-073cd03a2c5b0eb6c0872622f840f4a9724a9b04.tar.bz2
uClibc-alpine-073cd03a2c5b0eb6c0872622f840f4a9724a9b04.tar.xz
Fix by Martin Schlemmer:
If _DL_FINI_CRT_COMPAT is defined, _dl_fini is setup to run at exit via atexit(), but this makes it run _before_ the fini (__app_fini()) of the app, causing stuff like sandbox that frees structs, etc via its fini to segfault. http://bugs.gentoo.org/98187
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/atexit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 280f42cb7..c70318148 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -223,6 +223,11 @@ extern void (*__app_fini)(void);
#endif
extern void (*__rtld_fini)(void);
+
+#ifdef _DL_FINI_CRT_COMPAT
+extern void (*__dl_fini)(void);
+#endif
+
/*
* Normal program termination
*/
@@ -242,6 +247,9 @@ void exit(int rv)
#ifndef _DL_FINI_CRT_COMPAT
if (__rtld_fini != NULL)
(__rtld_fini)();
+#else
+ if (__dl_fini != NULL)
+ (__dl_fini)();
#endif
/* If we are using stdio, try to shut it down. At the very least,