From 27c0f951b2abea7b5fca99e180fc80b9fc12c456 Mon Sep 17 00:00:00 2001 From: davidxu Date: Sat, 28 Jun 2003 09:41:59 +0000 Subject: Write new thread pointer back only when success. Reviewed by: deischen --- lib/libpthread/thread/thr_create.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/libpthread/thread/thr_create.c') diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c index f552ee5..e9ab203 100644 --- a/lib/libpthread/thread/thr_create.c +++ b/lib/libpthread/thread/thr_create.c @@ -294,9 +294,10 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, ret = _thr_schedule_add(curthread, new_thread); if (ret != 0) free_thread(curthread, new_thread); - - /* Return a pointer to the thread structure: */ - (*thread) = new_thread; + else { + /* Return a pointer to the thread structure: */ + (*thread) = new_thread; + } } } -- cgit v1.1