From: Rich Felker Date: Mon, 20 Aug 2012 00:48:16 +0000 (-0400) Subject: fix bug whereby most atexit-registered functions got skipped X-Git-Tag: v0.9.5~82 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a749ba3adc2f3b4abfc68b21d4c3741b20c8f657;p=oweals%2Fmusl.git fix bug whereby most atexit-registered functions got skipped --- diff --git a/src/exit/atexit.c b/src/exit/atexit.c index 1b40cb9b..c31f3dc3 100644 --- a/src/exit/atexit.c +++ b/src/exit/atexit.c @@ -21,9 +21,8 @@ void __funcs_on_exit() int i; void (*func)(void *), *arg; LOCK(lock); - for (; head; head=head->next) { - for (i=COUNT-1; i>=0 && !head->f[i]; i--); - if (i<0) continue; + for (; head; head=head->next) for (i=COUNT-1; i>=0; i--) { + if (!head->f[i]) continue; func = head->f[i]; arg = head->a[i]; head->f[i] = 0;