summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/sys/thr_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/sys/thr_error.c')
-rw-r--r--lib/libpthread/sys/thr_error.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libpthread/sys/thr_error.c b/lib/libpthread/sys/thr_error.c
index f002ee9..a4a8507 100644
--- a/lib/libpthread/sys/thr_error.c
+++ b/lib/libpthread/sys/thr_error.c
@@ -34,16 +34,21 @@
* $FreeBSD$
*/
#include <pthread.h>
+#include "libc_private.h"
#include "thr_private.h"
extern int errno;
int * __error()
{
- int *p_errno;
- if (_thread_run == _thread_initial) {
- p_errno = &errno;
- } else {
- p_errno = &_thread_run->error;
+ struct pthread *curthread;
+
+ if (__isthreaded == 0)
+ return (&errno);
+ else {
+ curthread = _get_curthread();
+ if ((curthread == NULL) || (curthread == _thr_initial))
+ return (&errno);
+ else
+ return (&curthread->error);
}
- return(p_errno);
}
OpenPOWER on IntegriCloud