diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2010-05-26 21:40:06 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2010-05-26 21:40:06 +0000 |
commit | eca62d4b8c6a4888c9cc1eedaa4c4cb2b422a321 (patch) | |
tree | 41f175388cc90ccbd30f98a8c07394d22ae7fcb8 /lib/librthread/rthread_stack.c | |
parent | 0a2b6450eea47e3661023dc9b4853d9940b3c86b (diff) |
If the stack size attribute isn't larger than the guard-page size
attribute then make pthread_create() return EINVAL instead of whatever
was in errno on entry (possibly making it appear it succeeded when it
really failed). Encountered by Jung (moorang at gmail.com).
Diffstat (limited to 'lib/librthread/rthread_stack.c')
-rw-r--r-- | lib/librthread/rthread_stack.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/librthread/rthread_stack.c b/lib/librthread/rthread_stack.c index ea4aee7d359..cb85d8f8210 100644 --- a/lib/librthread/rthread_stack.c +++ b/lib/librthread/rthread_stack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_stack.c,v 1.3 2006/10/27 02:41:24 tedu Exp $ */ +/* $OpenBSD: rthread_stack.c,v 1.4 2010/05/26 21:40:05 guenther Exp $ */ /* $snafu: rthread_stack.c,v 1.12 2005/01/11 02:45:28 marc Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ @@ -9,6 +9,7 @@ #include <machine/param.h> #include <machine/spinlock.h> +#include <errno.h> #include <pthread.h> #include <stdlib.h> #include <unistd.h> @@ -76,6 +77,7 @@ _rthread_alloc_stack(pthread_t thread) stack->len = size; return (stack); } + errno = EINVAL; return (NULL); } |