summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libc/inet/resolv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index af38c14a5..0e7c4d8b8 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1127,11 +1127,22 @@ struct hostent *gethostbyname2(const char *name, int family)
#ifdef L_res_init
+#undef _res
struct __res_state _res;
+struct __res_state * weak_const_function __res_state (void)
+{
+ return &_res;
+}
+
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <tls.h>
+__thread struct __res_state *__resp = &_res;
+#endif
+
int res_init(void)
{
- struct __res_state *rp = &(_res);
+ struct __res_state *rp = __res_state();
__close_nameservers();
__open_nameservers();