diff options
author | ume <ume@FreeBSD.org> | 2006-12-15 20:59:55 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-12-15 20:59:55 +0000 |
commit | 705f242eca7e1a52b43a762cced4eaa8de4c0818 (patch) | |
tree | 2cc733581f24f5c52484da3c954755891790e893 /lib/libc/resolv | |
parent | bf42d1f92c9ee728800e7dea18fc78216171bddb (diff) | |
download | FreeBSD-src-705f242eca7e1a52b43a762cced4eaa8de4c0818.zip FreeBSD-src-705f242eca7e1a52b43a762cced4eaa8de4c0818.tar.gz |
Merge BIND9 9.3.3 into main chunk.
Obtained from: ISC
MFC after: 1 week
Diffstat (limited to 'lib/libc/resolv')
-rw-r--r-- | lib/libc/resolv/mtctxres.c | 7 | ||||
-rw-r--r-- | lib/libc/resolv/res_init.c | 17 | ||||
-rw-r--r-- | lib/libc/resolv/res_send.c | 5 |
3 files changed, 12 insertions, 17 deletions
diff --git a/lib/libc/resolv/mtctxres.c b/lib/libc/resolv/mtctxres.c index 86b5a79..f02a7f5 100644 --- a/lib/libc/resolv/mtctxres.c +++ b/lib/libc/resolv/mtctxres.c @@ -118,9 +118,10 @@ ___mtctxres(void) { */ if (!mt_key_initialized) { static pthread_mutex_t keylock = PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_lock(&keylock); - _mtctxres_init(); - pthread_mutex_unlock(&keylock); + if (pthread_mutex_lock(&keylock) == 0) { + _mtctxres_init(); + (void) pthread_mutex_unlock(&keylock); + } } /* diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index a42eb80..2d2ae1e 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static const char rcsid[] = "$Id: res_init.c,v 1.9.2.5.4.5 2005/11/03 00:00:52 marka Exp $"; +static const char rcsid[] = "$Id: res_init.c,v 1.9.2.5.4.6 2006/08/30 23:23:01 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -243,17 +243,10 @@ __res_vinit(res_state statp, int preinit) { if (buf[0] == '+') buf[0] = '.'; cp = strchr(buf, '.'); - if (cp == NULL) { - if (strlcpy(statp->defdname, buf, - sizeof(statp->defdname)) - >= sizeof(statp->defdname)) - goto freedata; - } else { - if (strlcpy(statp->defdname, cp+1, - sizeof(statp->defdname)) - >= sizeof(statp->defdname)) - goto freedata; - } + cp = (cp == NULL) ? buf : (cp + 1); + if (strlen(cp) >= sizeof(statp->defdname)) + goto freedata; + strcpy(statp->defdname, cp); } } #endif /* SOLARIS2 */ diff --git a/lib/libc/resolv/res_send.c b/lib/libc/resolv/res_send.c index f3fe531..7bd9317 100644 --- a/lib/libc/resolv/res_send.c +++ b/lib/libc/resolv/res_send.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_send.c,v 1.5.2.2.4.8 2006/03/08 04:13:31 marka Exp $"; +static const char rcsid[] = "$Id: res_send.c,v 1.5.2.2.4.9 2006/10/16 23:00:50 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -313,7 +313,8 @@ res_nsend(res_state statp, highestFD = sysconf(_SC_OPEN_MAX) - 1; #endif - if (statp->nscount == 0) { + /* No name servers or res_init() failure */ + if (statp->nscount == 0 || EXT(statp).ext == NULL) { errno = ESRCH; return (-1); } |