From: Volker Lendecke Date: Thu, 4 Jan 2018 19:58:05 +0000 (+0100) Subject: dns_lookup: Let make test override the resolv.conf location X-Git-Tag: talloc-2.1.15~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7418203eebafd4027abc45e27b411dfc51c1f3e;p=thirdparty%2Fsamba.git dns_lookup: Let make test override the resolv.conf location Make this a separate commit: That is the feature that libc unfortunately does not give us. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/libcli/dns/dns_lookup.c b/libcli/dns/dns_lookup.c index 6fc912cb8f3..b99ab426e10 100644 --- a/libcli/dns/dns_lookup.c +++ b/libcli/dns/dns_lookup.c @@ -68,7 +68,18 @@ struct tevent_req *dns_lookup_send(TALLOC_CTX *mem_ctx, state->qtype = qtype; if (resolv_conf_fp == NULL) { - fp = fopen("/etc/resolv.conf", "r"); + const char *resolvconf = "/etc/resolv.conf"; + +#ifdef DEVELOPER + { + const char *envvar = getenv("RESOLV_CONF"); + if (envvar != NULL) { + resolvconf = envvar; + } + } +#endif + + fp = fopen(resolvconf, "r"); if (fp == NULL) { tevent_req_error(req, errno); return tevent_req_post(req, ev);