summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/atexit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/atexit.c')
-rw-r--r--lib/libc/stdlib/atexit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index 9c4caed..ea2a7e2 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -40,6 +40,7 @@ static char sccsid[] = "@(#)atexit.c 8.1 (Berkeley) 6/4/93";
#include <stddef.h>
#include <stdlib.h>
+#include <unistd.h>
#include "atexit.h"
/*
@@ -55,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;
OpenPOWER on IntegriCloud