summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-01-28 16:47:42 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-01-28 16:47:42 +0000
commit5ace9272c7500b71cc5b89d4e9ca5dedb05c03bd (patch)
tree76c05fa5a3f9cb945bb7d10816ac7566bc0f4d09
parentdc5a9da956d163529955fb06761571452b712da4 (diff)
Return ESRCH instead of segfaulting when a thread ID could not be found.
ok marc@, krw@
-rw-r--r--lib/libpthread/uthread/uthread_kill.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_kill.c b/lib/libpthread/uthread/uthread_kill.c
index 92702e8b870..8b6c6e2456f 100644
--- a/lib/libpthread/uthread/uthread_kill.c
+++ b/lib/libpthread/uthread/uthread_kill.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_kill.c,v 1.11 2003/04/30 17:54:17 marc Exp $ */
+/* $OpenBSD: uthread_kill.c,v 1.12 2007/01/28 16:47:41 kettenis Exp $ */
/* PUBLIC_DOMAIN <marc@snafu.org> */
#include <errno.h>
@@ -41,7 +41,7 @@ pthread_kill(pthread_t pthread, int sig)
if (sig >= 0 && sig < NSIG) {
ret = _find_thread(pthread);
- if (sig != 0) {
+ if (ret == 0 && sig != 0) {
if (_thread_sigact[sig - 1].sa_handler != SIG_IGN) {
_thread_kern_sig_defer();
if (pthread->state == PS_SIGWAIT &&