From: deraadt Date: Wed, 7 Oct 2015 13:57:12 +0000 (+0000) Subject: getaddrinfo() should not res_init() unconditionally, but allow lower X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2ead0dac8a4e3fd4c81a98096ba84e9e2bd58dd7;p=openbsd 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 --- 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 * @@ -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) {