summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-18 08:50:08 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-18 08:50:08 +0000
commit5ce7dc9543896883a3e30a1e6676c9f4c215f382 (patch)
tree8e73a99319526176a3fc166bf339c21c5402c074
parentc35cde1edbe9d3375ed880fe8bb7d0fffba2f000 (diff)
Miles Bader writes:
Programs that don't use stdio crash in the `exit' function, because they call through the pointer__uClibc_cleanup, which has a value of 0. It has a value of 0 because __uClibc_main.c initializes it to the address of `__stdio_close_all', which is a weak symbol (and so is 0 if stdio is not used). This patch from Miles fixes it, though we need to audit __stdio_close_all usage to be sure...
-rw-r--r--libc/stdlib/atexit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index d7be35fbd..af739d52b 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -159,7 +159,8 @@ void exit(int rv)
}
/* Clean up everything else */
- __uClibc_cleanup();
+ if (__uClibc_cleanup) {
+ __uClibc_cleanup();
_exit(rv);
}