summaryrefslogtreecommitdiff
path: root/libc/misc/internals
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/misc/internals
parentee11fb2608a02a6563bc38dc1bc38510fcc0ab9e (diff)
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/misc/internals')
-rw-r--r--libc/misc/internals/__uClibc_main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 6f74e39e8..53bb02820 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -161,6 +161,16 @@ void attribute_hidden (*__app_fini)(void) = NULL;
void attribute_hidden (*__rtld_fini)(void) = NULL;
+#ifdef _DL_FINI_CRT_COMPAT
+void attribute_hidden (*__dl_fini)(void) = NULL;
+
+void _set__dl_fini(void *fini_func)
+{
+ if (fini_func != NULL)
+ __dl_fini = fini_func;
+}
+#endif
+
/* __uClibc_start_main is the new main stub for uClibc. This function is
* called from crt0 (version 0.9.16 or newer), after ALL shared libraries
* are initialized, just before we call the application's main function.