summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2015-10-28 21:38:46 +0000
committerEric Faurot <eric@cvs.openbsd.org>2015-10-28 21:38:46 +0000
commitc4986959c07d935fae6d468cb241a6d3daa1fa8e (patch)
tree775142941829787df6aaf3d3dd4699d3d0575d76 /lib/libc
parent0ec638d03a14afb4a968ec47acfc54280e67d85c (diff)
We are always using _PATH_RESCONF, so no need to remember the path on
the resolver. ok millert@ deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/asr/asr.c18
-rw-r--r--lib/libc/asr/asr_debug.c6
-rw-r--r--lib/libc/asr/asr_private.h3
3 files changed, 6 insertions, 21 deletions
diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c
index 0a407b8c971..f683ff73e8e 100644
--- a/lib/libc/asr/asr.c
+++ b/lib/libc/asr/asr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr.c,v 1.47 2015/10/28 11:52:26 deraadt Exp $ */
+/* $OpenBSD: asr.c,v 1.48 2015/10/28 21:38:45 eric Exp $ */
/*
* Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org>
*
@@ -68,7 +68,6 @@ static struct asr *_asr = NULL;
static void *
_asr_resolver(void)
{
- const char *conf = _PATH_RESCONF;
static int init = 0;
struct asr *asr;
@@ -83,10 +82,6 @@ _asr_resolver(void)
if ((asr = calloc(1, sizeof(*asr))) == NULL)
goto fail;
- /* Use the given config file */
- asr->a_path = strdup(conf);
- if (asr->a_path == NULL)
- goto fail;
asr_check_reload(asr);
if (asr->a_ctx == NULL) {
if ((asr->a_ctx = asr_ctx_create()) == NULL)
@@ -105,7 +100,6 @@ _asr_resolver(void)
if (asr) {
if (asr->a_ctx)
asr_ctx_free(asr->a_ctx);
- free(asr->a_path);
free(asr);
}
@@ -131,7 +125,6 @@ _asr_resolver_done(void *arg)
}
_asr_ctx_unref(asr->a_ctx);
- free(asr->a_path);
free(asr);
}
@@ -375,9 +368,6 @@ asr_check_reload(struct asr *asr)
struct timespec ts;
pid_t pid;
- if (asr->a_path == NULL)
- return;
-
pid = getpid();
if (pid != asr->a_pid) {
asr->a_pid = pid;
@@ -391,15 +381,15 @@ asr_check_reload(struct asr *asr)
return;
asr->a_rtime = ts.tv_sec;
- DPRINT("asr: checking for update of \"%s\"\n", asr->a_path);
- if (stat(asr->a_path, &st) == -1 ||
+ DPRINT("asr: checking for update of \"%s\"\n", _PATH_RESCONF);
+ if (stat(_PATH_RESCONF, &st) == -1 ||
asr->a_mtime == st.st_mtime ||
(ac = asr_ctx_create()) == NULL)
return;
asr->a_mtime = st.st_mtime;
DPRINT("asr: reloading config file\n");
- if (asr_ctx_from_file(ac, asr->a_path) == -1) {
+ if (asr_ctx_from_file(ac, _PATH_RESCONF) == -1) {
asr_ctx_free(ac);
return;
}
diff --git a/lib/libc/asr/asr_debug.c b/lib/libc/asr/asr_debug.c
index bcd0525efa1..09ce456d599 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.21 2015/10/03 09:57:30 eric Exp $ */
+/* $OpenBSD: asr_debug.c,v 1.22 2015/10/28 21:38:45 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -263,10 +263,6 @@ _asr_dump_config(FILE *f, struct asr *a)
ac = a->a_ctx;
fprintf(f, "--------- ASR CONFIG ---------------\n");
- if (a->a_path)
- fprintf(f, "CONF FILE \"%s\"\n", a->a_path);
- else
- fprintf(f, "STATIC CONF\n");
fprintf(f, "DOMAIN \"%s\"\n", ac->ac_domain);
fprintf(f, "SEARCH\n");
for (i = 0; i < ac->ac_domcount; i++)
diff --git a/lib/libc/asr/asr_private.h b/lib/libc/asr/asr_private.h
index cef9cae373e..f4a357afdf5 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.35 2015/10/07 13:59:34 deraadt Exp $ */
+/* $OpenBSD: asr_private.h,v 1.36 2015/10/28 21:38:45 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -140,7 +140,6 @@ struct asr_ctx {
};
struct asr {
- char *a_path;
pid_t a_pid;
time_t a_mtime;
time_t a_rtime;