diff options
Diffstat (limited to 'lib/libc/stdlib/atexit.c')
-rw-r--r-- | lib/libc/stdlib/atexit.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c index bbf374e..ea2a7e2 100644 --- a/lib/libc/stdlib/atexit.c +++ b/lib/libc/stdlib/atexit.c @@ -35,15 +35,14 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94"; +static char sccsid[] = "@(#)atexit.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <stddef.h> #include <stdlib.h> +#include <unistd.h> #include "atexit.h" -struct atexit *__atexit; /* points to head of LIFO stack */ - /* * Register a function to be performed at exit. */ @@ -57,7 +56,7 @@ atexit(fn) if ((p = __atexit) == NULL) __atexit = p = &__atexit0; else if (p->ind >= ATEXIT_SIZE) { - if ((p = malloc(sizeof(*p))) == NULL) + if ((p = (struct atexit *)sbrk(sizeof(*p))) == (struct atexit *)-1) return (-1); p->ind = 0; p->next = __atexit; |