commit | a749ba3adc2f3b4abfc68b21d4c3741b20c8f657 | [log] [tgz] |
---|---|---|
author | Rich Felker <dalias@aerifal.cx> | Sun Aug 19 20:48:16 2012 -0400 |
committer | Rich Felker <dalias@aerifal.cx> | Sun Aug 19 20:48:16 2012 -0400 |
tree | d81b6af48d6b09dc132890901f30a512e83ba492 | |
parent | 04109502c0355878d238bdba06a09b2593b2996f [diff] |
fix bug whereby most atexit-registered functions got skipped
diff --git a/src/exit/atexit.c b/src/exit/atexit.c index 1b40cb9..c31f3dc 100644 --- a/src/exit/atexit.c +++ b/src/exit/atexit.c
@@ -21,9 +21,8 @@ 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;