about summary refs log tree commit diff
path: root/src/env
diff options
context:
space:
mode:
Diffstat (limited to 'src/env')
-rw-r--r--src/env/__init_tls.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
index 89d081ef..e1a2b614 100644
--- a/src/env/__init_tls.c
+++ b/src/env/__init_tls.c
@@ -11,17 +11,12 @@ int __init_tp(void *p)
 {
 	pthread_t td = p;
 	td->self = td;
-	if (__set_thread_area(TP_ADJ(p)) < 0)
-		return -1;
+	int r = __set_thread_area(TP_ADJ(p));
+	if (r < 0) return -1;
+	if (!r) libc.can_do_threads = 1;
+	libc.has_thread_pointer = 1;
 	td->tid = td->pid = __syscall(SYS_set_tid_address, &td->tid);
 	td->errno_ptr = &td->errno_val;
-	/* Currently, both of these predicates depend in the same thing:
-	 * successful initialization of the thread pointer. However, in
-	 * the future, we may support setups where setting the thread
-	 * pointer is possible but threads other than the main thread
-	 * cannot work, so it's best to keep the predicates separate. */
-	libc.has_thread_pointer = 1;
-	libc.can_do_threads = 1;
 	return 0;
 }