diff options
Diffstat (limited to 'lib/libthr/sys')
-rw-r--r-- | lib/libthr/sys/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libthr/sys/thr_error.c | 19 |
2 files changed, 9 insertions, 14 deletions
diff --git a/lib/libthr/sys/Makefile.inc b/lib/libthr/sys/Makefile.inc index 59018f7..70c6dda 100644 --- a/lib/libthr/sys/Makefile.inc +++ b/lib/libthr/sys/Makefile.inc @@ -1,5 +1,5 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/sys ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} +.PATH: ${.CURDIR}/sys -SRCS+= thr_error.c +SRCS+= thr_error.c 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); } |