summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostbydns.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-04-15 14:42:29 +0000
committerume <ume@FreeBSD.org>2005-04-15 14:42:29 +0000
commitb8a79c699c2858b875020bba30ca8ced2a6e3ed1 (patch)
tree31c9250817dd4dd9b5e307af8645d111e227d398 /lib/libc/net/gethostbydns.c
parent53377abba9839772973c53e13f0df4571c7da0c6 (diff)
downloadFreeBSD-src-b8a79c699c2858b875020bba30ca8ced2a6e3ed1.zip
FreeBSD-src-b8a79c699c2858b875020bba30ca8ced2a6e3ed1.tar.gz
hostalias() is not thread-safe. So, introduce _res_hostalias()
and use it. Obtained from: BIND9
Diffstat (limited to 'lib/libc/net/gethostbydns.c')
-rw-r--r--lib/libc/net/gethostbydns.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c
index 7dc405d..24de7ff 100644
--- a/lib/libc/net/gethostbydns.c
+++ b/lib/libc/net/gethostbydns.c
@@ -96,6 +96,8 @@ static char *host_aliases[MAXALIASES];
static char hostbuf[8*1024];
static u_char host_addr[16]; /* IPv4 or IPv6 */
+extern const char *_res_hostalias(const char *, char *, size_t);
+
#ifdef RESOLVSORT
static void addrsort(char **, int);
#endif
@@ -477,6 +479,7 @@ _dns_gethostbyname(void *rval, void *cb_data, va_list ap)
const char *cp;
char *bp, *ep;
int n, size, type, len;
+ char abuf[MAXDNAME];
name = va_arg(ap, const char *);
af = va_arg(ap, int);
@@ -510,7 +513,8 @@ _dns_gethostbyname(void *rval, void *cb_data, va_list ap)
* this is also done in res_query() since we are not the only
* function that looks up host names.
*/
- if (!strchr(name, '.') && (cp = __hostalias(name)))
+ if (!strchr(name, '.') &&
+ (cp = _res_hostalias(name, abuf, sizeof abuf)))
name = cp;
/*
OpenPOWER on IntegriCloud