summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2008-08-14 05:57:07 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2008-08-14 05:57:07 +0000
commit733f511cf5bea0e1866aa4cc8b573de6f0979600 (patch)
treefcefb03ab8dd1afe420afc1f34ad9ec2ba4f891a /lib
parentee44450406aeeb5199575aa1bdaf88c249a2e52b (diff)
Match libpthread's behavior and make pthread_join(NULL, whatever) fail
instead of crashing ok kurt@ first observed by Jung <moorang at gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librthread/rthread.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c
index decb31e1c5b..da0a7564591 100644
--- a/lib/librthread/rthread.c
+++ b/lib/librthread/rthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread.c,v 1.37 2008/08/14 05:20:44 guenther Exp $ */
+/* $OpenBSD: rthread.c,v 1.38 2008/08/14 05:57:06 guenther Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -231,7 +231,9 @@ pthread_join(pthread_t thread, void **retval)
{
int e;
- if (thread->tid == getthrid())
+ if (thread == NULL)
+ e = EINVAL;
+ else if (thread->tid == getthrid())
e = EDEADLK;
else if (thread->flags & THREAD_DETACHED)
e = EINVAL;