svn commit: branches/uClibc_0_9_28/libc/inet

andersen at uclibc.org andersen at uclibc.org
Fri Feb 2 01:03:29 UTC 2007


Author: andersen
Date: 2007-02-01 17:03:29 -0800 (Thu, 01 Feb 2007)
New Revision: 17707

Log:
use the correct lock to guard access to the __nameserver[] global


Modified:
   branches/uClibc_0_9_28/libc/inet/resolv.c


Changeset:
Modified: branches/uClibc_0_9_28/libc/inet/resolv.c
===================================================================
--- branches/uClibc_0_9_28/libc/inet/resolv.c	2007-02-02 01:01:51 UTC (rev 17706)
+++ branches/uClibc_0_9_28/libc/inet/resolv.c	2007-02-02 01:03:29 UTC (rev 17707)
@@ -695,11 +695,11 @@
 		++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 @@
 				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 @@
 #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__
 		}




More information about the uClibc-cvs mailing list