aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>2007-02-02 01:03:29 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>2007-02-02 01:03:29 +0000
commit62a7782180447b91312ab2fdffc04ac19a5d58ab (patch)
tree6350de138821cd355396a2c91f54771d28020449
parent06f7bab6712d140a4a021131fc6513d06771b218 (diff)
downloaduClibc-62a7782180447b91312ab2fdffc04ac19a5d58ab.tar.gz
uClibc-62a7782180447b91312ab2fdffc04ac19a5d58ab.tar.bz2
use the correct lock to guard access to the __nameserver[] global
-rw-r--r--libc/inet/resolv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 48cd026bf..e1f274dde 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -695,11 +695,11 @@ int __dns_lookup(const char *name, int type, int nscount, char **nsip,
++local_id;
local_id &= 0xffff;
h.id = local_id;
- BIGLOCK;
+ __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];
- BIGUNLOCK;
+ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
h.qdcount = 1;
h.rd = 1;
@@ -734,11 +734,11 @@ int __dns_lookup(const char *name, int type, int nscount, char **nsip,
retries+1, NAMESERVER_PORT, dns);
#ifdef __UCLIBC_HAS_IPV6__
- BIGLOCK;
+ __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;
- BIGUNLOCK;
+ __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);
@@ -759,11 +759,11 @@ int __dns_lookup(const char *name, int type, int nscount, char **nsip,
#endif
sa.sin_family = AF_INET;
sa.sin_port = htons(NAMESERVER_PORT);
- BIGLOCK;
+ __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);
- BIGUNLOCK;
+ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
rc = connect(fd, (struct sockaddr *) &sa, sizeof(sa));
#ifdef __UCLIBC_HAS_IPV6__
}