summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-19 20:48:16 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-19 20:48:16 -0400
commita749ba3adc2f3b4abfc68b21d4c3741b20c8f657 (patch)
treed81b6af48d6b09dc132890901f30a512e83ba492 /src
parent04109502c0355878d238bdba06a09b2593b2996f (diff)
downloadmusl-a749ba3adc2f3b4abfc68b21d4c3741b20c8f657.tar.gz
musl-a749ba3adc2f3b4abfc68b21d4c3741b20c8f657.tar.bz2
musl-a749ba3adc2f3b4abfc68b21d4c3741b20c8f657.tar.xz
musl-a749ba3adc2f3b4abfc68b21d4c3741b20c8f657.zip
fix bug whereby most atexit-registered functions got skipped
Diffstat (limited to 'src')
-rw-r--r--src/exit/atexit.c5
1 files changed, 2 insertions, 3 deletions
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;