diff options
Diffstat (limited to 'libc/inet')
-rw-r--r-- | libc/inet/resolv.c | 14 | ||||
-rw-r--r-- | libc/inet/rpc/rpc_thread.c | 3 |
2 files changed, 6 insertions, 11 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 0c73fcab3..eab86c0e8 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -647,7 +647,7 @@ int __form_query(int id, const char *name, int type, unsigned char *packet, } #endif -#ifdef L_dnslookup +#if defined(L_dnslookup) || defined(L_gethostent) #ifdef __UCLIBC_HAS_THREADS__ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; @@ -657,6 +657,9 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; # define LOCK # define UNLOCK #endif +#endif + +#ifdef L_dnslookup /* Just for the record, having to lock __dns_lookup() just for these two globals * is pretty lame. I think these two variables can probably be de-global-ized, @@ -1587,15 +1590,6 @@ int __read_etc_hosts_r(FILE * fp, const char * name, int type, #ifdef L_gethostent -#ifdef __UCLIBC_HAS_THREADS__ -static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK -#endif - static int __stay_open; static FILE * __gethostent_fp; diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c index e3a1c40b2..374aac84c 100644 --- a/libc/inet/rpc/rpc_thread.c +++ b/libc/inet/rpc/rpc_thread.c @@ -2,11 +2,12 @@ #include <features.h> #include <stdio.h> #include <assert.h> -#include <bits/libc-tsd.h> #include "rpc_private.h" #ifdef __UCLIBC_HAS_THREADS__ +#include <bits/libc-tsd.h> + /* Variable used in non-threaded applications or for the first thread. */ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; #ifdef __UCLIBC_HAS_THREADS_NATIVE__ |