diff options
Diffstat (limited to 'lib/libc/sys/__error.c')
| -rw-r--r-- | lib/libc/sys/__error.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/libc/sys/__error.c b/lib/libc/sys/__error.c index c3f59f8bf828c..28cc31dde1775 100644 --- a/lib/libc/sys/__error.c +++ b/lib/libc/sys/__error.c @@ -32,14 +32,25 @@ __FBSDID("$FreeBSD$"); extern int errno; -/* - * Declare a weak reference in case the application is not linked - * with libpthread. - */ -__weak_reference(__error_unthreaded, __error); +static int * +__error_unthreaded(void) +{ + + return (&errno); +} + +static int *(*__error_selector)(void) = __error_unthreaded; + +void +__set_error_selector(int *(*arg)(void)) +{ + + __error_selector = arg; +} int * -__error_unthreaded(void) +__error(void) { - return(&errno); + + return (__error_selector()); } |
