summaryrefslogtreecommitdiff
path: root/lib/librthread/rthread_np.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-11-29 16:27:41 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-11-29 16:27:41 +0000
commit32b4cc06b820e70b40cb6c9d9b528f9832a5ea18 (patch)
tree0b9c01a2e776843e803fa5b2249d0c80073db180 /lib/librthread/rthread_np.c
parentdb24c1c957e1675a1adf3d2b7a0fb24ab643e614 (diff)
Don't try to reuse _initial_thread in the fork() wrapper, as the
thread's existing handle must continue to be valid and it didn't fully 'change' the thread handle anyway. For pthread_main_np(), use a new flag, THREAD_ORIGINAL, to indicate that the flagged thread is the original thread for *this* process. Fixes some ConsoleKit failures according to aja@
Diffstat (limited to 'lib/librthread/rthread_np.c')
-rw-r--r--lib/librthread/rthread_np.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/librthread/rthread_np.c b/lib/librthread/rthread_np.c
index 75366b8adb1..0cbb24e74e7 100644
--- a/lib/librthread/rthread_np.c
+++ b/lib/librthread/rthread_np.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_np.c,v 1.9 2013/11/13 16:56:17 deraadt Exp $ */
+/* $OpenBSD: rthread_np.c,v 1.10 2013/11/29 16:27:40 guenther Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2005 Otto Moerbeek <otto@openbsd.org>
@@ -45,7 +45,8 @@ pthread_set_name_np(pthread_t thread, const char *name)
int
pthread_main_np(void)
{
- return (!_threads_ready || pthread_self() == &_initial_thread ? 1 : 0);
+ return (!_threads_ready || (pthread_self()->flags & THREAD_ORIGINAL)
+ ? 1 : 0);
}