Fix pthread key num calculation.
Bug: 18723085
Change-Id: Iba2c834b350e4cdba0b2d771b221560a3e5df952
diff --git a/libc/dns/resolv/res_state.c b/libc/dns/resolv/res_state.c
index 57791d1..75bff97 100644
--- a/libc/dns/resolv/res_state.c
+++ b/libc/dns/resolv/res_state.c
@@ -50,7 +50,6 @@
#endif
static pthread_key_t _res_key;
-static pthread_once_t _res_once = PTHREAD_ONCE_INIT;
typedef struct {
int _h_errno;
@@ -105,6 +104,7 @@
free(rt);
}
+__attribute__((constructor))
static void
_res_init_key( void )
{
@@ -115,7 +115,6 @@
_res_thread_get(void)
{
_res_thread* rt;
- pthread_once( &_res_once, _res_init_key );
rt = pthread_getspecific( _res_key );
if (rt != NULL) {