Call atexit handlers properly, avoiding a NPE and seg fault every time a
program exits.
This commit is contained in:
parent
2eaca39322
commit
79fd34dac6
|
@ -15,8 +15,8 @@ int __funccnt = 0;
|
||||||
void exit(int status)
|
void exit(int status)
|
||||||
{
|
{
|
||||||
/* "Called in reversed order of their registration" */
|
/* "Called in reversed order of their registration" */
|
||||||
while (__funccnt >= 0)
|
while (__funccnt)
|
||||||
(*__functab[__funccnt])();
|
(*__functab[--__funccnt])();
|
||||||
|
|
||||||
_exit(status);
|
_exit(status);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue