summaryrefslogtreecommitdiffstats
path: root/lib/libc/resolv/res_init.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-12-15 19:52:02 +0000
committerngie <ngie@FreeBSD.org>2015-12-15 19:52:02 +0000
commit3fed53d02350ae9cbd7b2786b72b83d2e292b8d1 (patch)
tree57320bb171eaf81a24aa51f751919d972710edf9 /lib/libc/resolv/res_init.c
parent17ca717571c27f52897c406a71864f864ca65710 (diff)
parent3713a6d4d1859668807d1f8c46fc21b15334f7c9 (diff)
downloadFreeBSD-src-3fed53d02350ae9cbd7b2786b72b83d2e292b8d1.zip
FreeBSD-src-3fed53d02350ae9cbd7b2786b72b83d2e292b8d1.tar.gz
MFhead @ r292285
Diffstat (limited to 'lib/libc/resolv/res_init.c')
-rw-r--r--lib/libc/resolv/res_init.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index 087e6a8..8832342 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -116,7 +116,9 @@ __FBSDID("$FreeBSD$");
/*% Options. Should all be left alone. */
#define RESOLVSORT
-#define DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
#ifdef SOLARIS2
#include <sys/systeminfo.h>
@@ -228,7 +230,6 @@ __res_vinit(res_state statp, int preinit) {
statp->pfcode = 0;
statp->_vcsock = -1;
statp->_flags = 0;
- statp->reload_period = 2;
statp->qhook = NULL;
statp->rhook = NULL;
statp->_u._ext.nscount = 0;
@@ -238,6 +239,7 @@ __res_vinit(res_state statp, int preinit) {
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
+ statp->_u._ext.ext->reload_period = 2;
} else {
/*
* Historically res_init() rarely, if at all, failed.
@@ -326,17 +328,13 @@ __res_vinit(res_state statp, int preinit) {
struct stat sb;
struct timespec now;
- if (_fstat(fileno(fp), &sb) == 0) {
- statp->conf_mtim = sb.st_mtim;
- if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) == 0) {
- statp->conf_stat = now.tv_sec;
- } else {
- statp->conf_stat = 0;
+ if (statp->_u._ext.ext != NULL) {
+ if (_fstat(fileno(fp), &sb) == 0) {
+ statp->_u._ext.ext->conf_mtim = sb.st_mtim;
+ if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) == 0) {
+ statp->_u._ext.ext->conf_stat = now.tv_sec;
+ }
}
- } else {
- statp->conf_mtim.tv_sec = 0;
- statp->conf_mtim.tv_nsec = 0;
- statp->conf_stat = 0;
}
/* read the config file */
@@ -599,9 +597,7 @@ res_setoptions(res_state statp, const char *options, const char *source)
{
const char *cp = options;
int i;
-#ifndef _LIBC
struct __res_state_ext *ext = statp->_u._ext.ext;
-#endif
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@@ -686,8 +682,10 @@ res_setoptions(res_state statp, const char *options, const char *source)
statp->options |= RES_NOCHECKNAME;
} else if (!strncmp(cp, "reload-period:",
sizeof("reload-period:") - 1)) {
- statp->reload_period = (u_short)
- atoi(cp + sizeof("reload-period:") - 1);
+ if (ext != NULL) {
+ ext->reload_period = (u_short)
+ atoi(cp + sizeof("reload-period:") - 1);
+ }
}
#ifdef RES_USE_EDNS0
else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
OpenPOWER on IntegriCloud