diff options
author | Eric Andersen <andersen@codepoet.org> | 2007-02-02 01:01:51 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2007-02-02 01:01:51 +0000 |
commit | f21e442f635260e070527637c04574a4fe95fb4b (patch) | |
tree | 3ed6c446ec685f65d64026202ca7b826b18c4bc8 /libc/inet/resolv.c | |
parent | 94b7f1f35ed787871f72c1d400817e80a546a14e (diff) |
use the correct lock for access to __nameserver[]
Diffstat (limited to 'libc/inet/resolv.c')
-rw-r--r-- | libc/inet/resolv.c | 18 |
1 files 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__ } |