summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-12-27 23:36:23 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-12-27 23:36:23 +0000
commite919981c95644082a0ea16f0bed7af04664a6c89 (patch)
tree5c93212d98db87997dc84ab1ce4d1bc07e4b4972 /libc/stdlib
parentd05dafe2fc23137f8decd641d82d23f45e16281c (diff)
Handle the app_fini stuff in exit without requiring atexit().
This avoids pulling in all the malloc/free code for a simple true/false app.
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/atexit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 9a467bf79..082e532fd 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -218,6 +218,10 @@ void (*__exit_cleanup) (int) = 0;
pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
#endif
+#ifdef __UCLIBC_CTOR_DTOR__
+extern void (*__app_fini)(void);
+#endif
+
/*
* Normal program termination
*/
@@ -230,6 +234,11 @@ void exit(int rv)
}
UNLOCK;
+#ifdef __UCLIBC_CTOR_DTOR__
+ if (__app_fini != NULL)
+ (__app_fini)();
+#endif
+
/* If we are using stdio, try to shut it down. At the very least,
* this will attempt to commit all buffered writes. It may also
* unbuffer all writable files, or close them outright.