summaryrefslogtreecommitdiffstats
path: root/libc/arch-arm
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-09-05 10:18:43 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-09-05 10:18:43 -0700
commitb2c5bd543dcbbc1b2cbf7afd8b124256ce2c128e (patch)
treebc8800e46aecc0a879a8ac707ab9759d1412b132 /libc/arch-arm
parent26f2e4a1639a959513c4ff5981b4eb52757e8012 (diff)
parent144c2918668ac0d506a86478d5b9966ad816cec4 (diff)
downloadbionic-b2c5bd543dcbbc1b2cbf7afd8b124256ce2c128e.zip
bionic-b2c5bd543dcbbc1b2cbf7afd8b124256ce2c128e.tar.gz
bionic-b2c5bd543dcbbc1b2cbf7afd8b124256ce2c128e.tar.bz2
Merge "ARM: warn about atexit() calls from legacy shared libraries"
Diffstat (limited to 'libc/arch-arm')
-rw-r--r--libc/arch-arm/bionic/atexit_legacy.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libc/arch-arm/bionic/atexit_legacy.c b/libc/arch-arm/bionic/atexit_legacy.c
index 09da17c..4abe839 100644
--- a/libc/arch-arm/bionic/atexit_legacy.c
+++ b/libc/arch-arm/bionic/atexit_legacy.c
@@ -27,6 +27,8 @@
*/
#include <sys/types.h>
+#include <private/logd.h>
+#include <stdio.h>
/*
* This source file should only be included by libc.so, its purpose is
@@ -42,5 +44,17 @@ extern int __cxa_atexit(void (*func)(void *), void *arg, void *dso);
int
atexit(void (*func)(void))
{
+ /*
+ * Exit functions queued by this version of atexit will not be called
+ * on dlclose(), and when they are called (at program exit), the
+ * calling library may have been dlclose()'d, causing the program to
+ * crash.
+ */
+ static char const warning[] =
+ "WARNING: generic atexit() called from legacy shared library\n";
+
+ __libc_android_log_print(ANDROID_LOG_WARN, "libc", warning);
+ fprintf(stderr, warning);
+
return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
}