summaryrefslogtreecommitdiff
path: root/lib/libpthread/sys/thr_error.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2003-04-18 05:02:39 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2003-04-18 05:02:39 +0000
commitb025fc9a31c85b9cde9969e1fea55ea4caf650d5 (patch)
tree2febe1cd446be41a73ffb1d52a365735e68244da /lib/libpthread/sys/thr_error.c
parent27f625a0361f01763bb29f6e303fed6dea9ecabe (diff)
Notes
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 f002ee9210148..a4a85078f2279 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);
}