summaryrefslogtreecommitdiffstats
path: root/lib/libthr/sys/thr_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/sys/thr_error.c')
-rw-r--r--lib/libthr/sys/thr_error.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/libthr/sys/thr_error.c b/lib/libthr/sys/thr_error.c
index 726c0df..902c054 100644
--- a/lib/libthr/sys/thr_error.c
+++ b/lib/libthr/sys/thr_error.c
@@ -35,25 +35,20 @@
*/
#include <pthread.h>
+
+#include "libc_private.h"
#include "thr_private.h"
#undef errno
extern int errno;
-__weak_reference(___error, __error);
-
int *
-___error()
+__error(void)
{
- struct pthread *pthread;
-
- if (_thread_initial == NULL)
- return (&errno);
-
- pthread = _get_curthread();
+ struct pthread *curthread = _get_curthread();
- if (pthread == _thread_initial)
+ if (curthread != NULL && curthread != _thr_initial)
+ return (&curthread->error);
+ else
return (&errno);
-
- return (&pthread->error);
}
OpenPOWER on IntegriCloud