diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-02-01 07:58:31 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-02-01 07:58:31 +0000 |
commit | fdbd5c9db5bb7c145eb1ca0c1191f84e6b84aac8 (patch) | |
tree | 492e74db58ae2f42c4e6d85268938401039ec0f7 /lib/libc/stdlib | |
parent | 2f0b4263a663ad32afa54f525880e6a8fd93f609 (diff) |
malloc can't use write() if it fails very early, so use the unwrapped syscall _thread_sys_write() if we are threaded
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index ecbf93dc489..55d00e50722 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -8,7 +8,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: malloc.c,v 1.33 1998/11/20 11:18:50 d Exp $"; +static char rcsid[] = "$OpenBSD: malloc.c,v 1.34 1999/02/01 07:58:30 d Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -102,6 +102,15 @@ static char rcsid[] = "$OpenBSD: malloc.c,v 1.33 1998/11/20 11:18:50 d Exp $"; # define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&malloc_lock) # define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&malloc_lock) # define THREAD_LOCK_INIT() + /* + * Malloc can't use the wrapped write() if it fails very early, so + * we use the unwrapped syscall _thread_sys_write() + */ +# define write _thread_sys_write + int write __P((int, const void *, size_t)); +# undef malloc +# undef realloc +# undef free # endif #else /* no threads */ |