From f21e442f635260e070527637c04574a4fe95fb4b Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 2 Feb 2007 01:01:51 +0000 Subject: use the correct lock for access to __nameserver[] --- libc/inet/resolv.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 403f5c73f..59819819e 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -753,11 +753,11 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char ++local_id; local_id &= 0xffff; h.id = local_id; - __UCLIBC_MUTEX_LOCK(mylock); + __UCLIBC_MUTEX_LOCK(__resolv_lock); /* this is really __nameserver[] which is a global that - needs a lock!! */ + needs to hold __resolv_lock before access!! */ dns = nsip[local_ns]; - __UCLIBC_MUTEX_UNLOCK(mylock); + __UCLIBC_MUTEX_UNLOCK(__resolv_lock); h.qdcount = 1; h.rd = 1; @@ -792,11 +792,11 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char retries+1, NAMESERVER_PORT, dns); #ifdef __UCLIBC_HAS_IPV6__ - __UCLIBC_MUTEX_LOCK(mylock); + __UCLIBC_MUTEX_LOCK(__resolv_lock); /* 'dns' is really __nameserver[] which is a global that - needs a lock!! */ + needs to hold __resolv_lock before access!! */ v6 = inet_pton(AF_INET6, dns, &sa6.sin6_addr) > 0; - __UCLIBC_MUTEX_UNLOCK(mylock); + __UCLIBC_MUTEX_UNLOCK(__resolv_lock); fd = socket(v6 ? AF_INET6 : AF_INET, SOCK_DGRAM, IPPROTO_UDP); #else fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -817,11 +817,11 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char #endif sa.sin_family = AF_INET; sa.sin_port = htons(NAMESERVER_PORT); - __UCLIBC_MUTEX_LOCK(mylock); + __UCLIBC_MUTEX_LOCK(__resolv_lock); /* 'dns' is really __nameserver[] which is a global that - needs a lock!! */ + needs to hold __resolv_lock before access!! */ sa.sin_addr.s_addr = inet_addr(dns); - __UCLIBC_MUTEX_UNLOCK(mylock); + __UCLIBC_MUTEX_UNLOCK(__resolv_lock); rc = connect(fd, (struct sockaddr *) &sa, sizeof(sa)); #ifdef __UCLIBC_HAS_IPV6__ } -- cgit v1.2.3