diff options
author | 2015-10-07 13:57:12 +0000 | |
---|---|---|
committer | 2015-10-07 13:57:12 +0000 | |
commit | 2ead0dac8a4e3fd4c81a98096ba84e9e2bd58dd7 (patch) | |
tree | 386d9a5616d1952d4d8c39ccf00938ae0ed3ad54 /lib/libc/asr/getaddrinfo.c | |
parent | include <sys/time.h> for gettimeofday(2) (diff) | |
download | wireguard-openbsd-2ead0dac8a4e3fd4c81a98096ba84e9e2bd58dd7.tar.xz wireguard-openbsd-2ead0dac8a4e3fd4c81a98096ba84e9e2bd58dd7.zip |
getaddrinfo() should not res_init() unconditionally, but allow lower
layers to decide. The request could be AI_NUMERICHOST. [And the process
could be tame()-constrained to not open /etc/resolv.conf]
ok eric guenther
Diffstat (limited to 'lib/libc/asr/getaddrinfo.c')
-rw-r--r-- | lib/libc/asr/getaddrinfo.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/asr/getaddrinfo.c b/lib/libc/asr/getaddrinfo.c index d988b9ae16d..e932e46b948 100644 --- a/lib/libc/asr/getaddrinfo.c +++ b/lib/libc/asr/getaddrinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getaddrinfo.c,v 1.6 2015/09/14 07:38:37 guenther Exp $ */ +/* $OpenBSD: getaddrinfo.c,v 1.7 2015/10/07 13:57:12 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -32,7 +32,8 @@ getaddrinfo(const char *hostname, const char *servname, struct asr_result ar; int saved_errno = errno; - res_init(); + if ((hints->ai_flags & AI_NUMERICHOST) == 0) + res_init(); as = getaddrinfo_async(hostname, servname, hints, NULL); if (as == NULL) { |