diff options
-rw-r--r-- | libc/stdlib/atexit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index e4b6620e2..44abc343b 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -147,8 +147,8 @@ void __exit_handler(int status) struct exit_function *efp; /* In reverse order */ - for ( ; __exit_count-- ; ) { - efp = &__exit_function_table[__exit_count]; + while ( __exit_count ) { + efp = &__exit_function_table[--__exit_count]; switch (efp->type) { case ef_on_exit: if (efp->funcs.on_exit.func) { |