summaryrefslogtreecommitdiff
path: root/lib/libthr/thread
diff options
context:
space:
mode:
authorMike Makonnen <mtm@FreeBSD.org>2004-03-26 14:45:35 +0000
committerMike Makonnen <mtm@FreeBSD.org>2004-03-26 14:45:35 +0000
commit8733f60328ce6f3eac1eb16747c8e860f07cfff9 (patch)
tree14b1e8ac9e7d77bffee09b374617233fb8226972 /lib/libthr/thread
parentab82970ed2bc15c3b83fb33e8fd84faf072c8c42 (diff)
Notes
Diffstat (limited to 'lib/libthr/thread')
-rw-r--r--lib/libthr/thread/thr_find_thread.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_find_thread.c b/lib/libthr/thread/thr_find_thread.c
index bd51b8fa0bc3..a00d19e0d3ef 100644
--- a/lib/libthr/thread/thr_find_thread.c
+++ b/lib/libthr/thread/thr_find_thread.c
@@ -41,18 +41,21 @@ _find_thread(pthread_t pthread)
{
pthread_t pthread1;
- if (pthread == NULL || pthread->magic != PTHREAD_MAGIC)
+ if (pthread == NULL)
return(EINVAL);
THREAD_LIST_LOCK;
/* Search for the specified thread: */
+ pthread1 = NULL;
TAILQ_FOREACH(pthread1, &_thread_list, tle) {
if (pthread == pthread1)
break;
}
THREAD_LIST_UNLOCK;
+ if (pthread1 != NULL && pthread1->magic != PTHREAD_MAGIC)
+ return (EINVAL);
/* Return zero if the thread exists: */
return ((pthread1 != NULL) ? 0:ESRCH);