OSDN Git Service

Miles Bader writes:
authorEric Andersen <andersen@codepoet.org>
Mon, 18 Feb 2002 08:50:08 +0000 (08:50 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 18 Feb 2002 08:50:08 +0000 (08:50 -0000)
    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...

libc/stdlib/atexit.c

index d7be35f..af739d5 100644 (file)
@@ -159,7 +159,8 @@ void exit(int rv)
        }
 
        /* Clean up everything else */
-       __uClibc_cleanup();
+       if (__uClibc_cleanup) {
+           __uClibc_cleanup();
 
        _exit(rv);
 }