From d2d7f9c9347db0370dc77f3195becbfc263c6f44 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 26 May 2015 19:28:57 +0000 Subject: [PATCH] simply use _PATH_HOSTS where appropriate --- lib/libc/asr/asr.c | 5 +---- lib/libc/asr/asr_debug.c | 3 +-- lib/libc/asr/asr_private.h | 4 +--- lib/libc/asr/getaddrinfo_async.c | 4 ++-- lib/libc/asr/gethostnamadr_async.c | 4 ++-- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c index 65ad511c975..09d8172c25b 100644 --- a/lib/libc/asr/asr.c +++ b/lib/libc/asr/asr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr.c,v 1.35 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: asr.c,v 1.36 2015/05/26 19:28:57 eric Exp $ */ /* * Copyright (c) 2010-2012 Eric Faurot * @@ -58,7 +58,6 @@ #endif #define DEFAULT_CONFFILE "/etc/resolv.conf" -#define DEFAULT_HOSTFILE "/etc/hosts" #define DEFAULT_CONF "lookup file\n" #define DEFAULT_LOOKUP "lookup bind file" @@ -523,8 +522,6 @@ asr_ctx_create(void) ac->ac_family[1] = AF_INET6; ac->ac_family[2] = -1; - ac->ac_hostfile = DEFAULT_HOSTFILE; - ac->ac_nscount = 0; ac->ac_nstimeout = 5; ac->ac_nsretries = 4; diff --git a/lib/libc/asr/asr_debug.c b/lib/libc/asr/asr_debug.c index 46d7310e880..33bdf347f2c 100644 --- a/lib/libc/asr/asr_debug.c +++ b/lib/libc/asr/asr_debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr_debug.c,v 1.17 2014/03/26 18:13:15 eric Exp $ */ +/* $OpenBSD: asr_debug.c,v 1.18 2015/05/26 19:28:57 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -302,7 +302,6 @@ asr_dump_config(FILE *f, struct asr *a) for (i = 0; i < ac->ac_nscount; i++) fprintf(f, " %s\n", print_sockaddr(ac->ac_ns[i], buf, sizeof buf)); - fprintf(f, "HOSTFILE %s\n", ac->ac_hostfile); fprintf(f, "LOOKUP %s", ac->ac_db); fprintf(f, "\n------------------------------------\n"); } diff --git a/lib/libc/asr/asr_private.h b/lib/libc/asr/asr_private.h index 9c6801b9305..b533e62c5b8 100644 --- a/lib/libc/asr/asr_private.h +++ b/lib/libc/asr/asr_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asr_private.h,v 1.27 2015/02/14 20:15:05 jca Exp $ */ +/* $OpenBSD: asr_private.h,v 1.28 2015/05/26 19:28:57 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -132,8 +132,6 @@ struct asr_ctx { char ac_db[ASR_MAXDB + 1]; int ac_family[3]; - char *ac_hostfile; - int ac_nscount; int ac_nstimeout; int ac_nsretries; diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c index b075d68f26b..eced898c20d 100644 --- a/lib/libc/asr/getaddrinfo_async.c +++ b/lib/libc/asr/getaddrinfo_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getaddrinfo_async.c,v 1.38 2015/05/25 21:59:37 jca Exp $ */ +/* $OpenBSD: getaddrinfo_async.c,v 1.39 2015/05/26 19:28:57 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -396,7 +396,7 @@ getaddrinfo_async_run(struct asr_query *as, struct asr_result *ar) break; case ASR_DB_FILE: - f = fopen(as->as_ctx->ac_hostfile, "re"); + f = fopen(_PATH_HOSTS, "re"); if (f == NULL) { async_set_state(as, ASR_STATE_NEXT_DB); break; diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c index 7f39e777343..656c8e7faf1 100644 --- a/lib/libc/asr/gethostnamadr_async.c +++ b/lib/libc/asr/gethostnamadr_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gethostnamadr_async.c,v 1.35 2015/03/02 14:22:48 brynet Exp $ */ +/* $OpenBSD: gethostnamadr_async.c,v 1.36 2015/05/26 19:28:57 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -249,7 +249,7 @@ gethostnamadr_async_run(struct asr_query *as, struct asr_result *ar) /* Try to find a match in the host file */ - if ((f = fopen(as->as_ctx->ac_hostfile, "re")) == NULL) + if ((f = fopen(_PATH_HOSTS, "re")) == NULL) break; if (as->as_type == ASR_GETHOSTBYNAME) { -- 2.20.1