Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net - don't clobber hp in the RES_USE_INET6 case
details: https://anonhg.NetBSD.org/src/rev/7e5432c362e2
branches: trunk
changeset: 325388:7e5432c362e2
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 22 02:45:16 2013 +0000
description:
- don't clobber hp in the RES_USE_INET6 case
- increment naddrs in the yp case
- don't use __hostalias(), it is not thread-safe.
diffstat:
lib/libc/net/gethnamaddr.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diffs (60 lines):
diff -r 79463c8fbd9d -r 7e5432c362e2 lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c Sun Dec 22 02:40:48 2013 +0000
+++ b/lib/libc/net/gethnamaddr.c Sun Dec 22 02:45:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.84 2013/08/27 09:56:12 christos Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.85 2013/12/22 02:45:16 christos Exp $ */
/*
* ++Copyright++ 1985, 1988, 1993
@@ -57,7 +57,7 @@
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
#else
-__RCSID("$NetBSD: gethnamaddr.c,v 1.84 2013/08/27 09:56:12 christos Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.85 2013/12/22 02:45:16 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -514,11 +514,11 @@
_DIAGASSERT(name != NULL);
if (res->options & RES_USE_INET6) {
- hp = gethostbyname_internal(name, AF_INET6, res, hp, buf,
- buflen, he);
- if (hp) {
+ struct hostent *nhp = gethostbyname_internal(name, AF_INET6,
+ res, hp, buf, buflen, he);
+ if (nhp) {
__res_put_state(res);
- return hp;
+ return nhp;
}
}
hp = gethostbyname_internal(name, AF_INET, res, hp, buf, buflen, he);
@@ -547,6 +547,7 @@
{
const char *cp;
struct getnamaddr info;
+ char hbuf[MAXHOSTNAMELEN];
size_t size;
static const ns_dtab dtab[] = {
NS_FILES_CB(_hf_gethtbyname, NULL)
@@ -580,7 +581,8 @@
* this is also done in res_nquery() since we are not the only
* function that looks up host names.
*/
- if (!strchr(name, '.') && (cp = __hostalias(name)))
+ if (!strchr(name, '.') && (cp = res_hostalias(res, name,
+ hbuf, sizeof(hbuf))))
name = cp;
/*
@@ -1128,6 +1130,7 @@
}
goto done;
}
+ naddrs++;
while (*cp == ' ' || *cp == '\t')
cp++;
Home |
Main Index |
Thread Index |
Old Index