diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-15 19:52:02 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-15 19:52:02 +0000 |
commit | 3fed53d02350ae9cbd7b2786b72b83d2e292b8d1 (patch) | |
tree | 57320bb171eaf81a24aa51f751919d972710edf9 /lib/libc/resolv/res_state.c | |
parent | 17ca717571c27f52897c406a71864f864ca65710 (diff) | |
parent | 3713a6d4d1859668807d1f8c46fc21b15334f7c9 (diff) | |
download | FreeBSD-src-3fed53d02350ae9cbd7b2786b72b83d2e292b8d1.zip FreeBSD-src-3fed53d02350ae9cbd7b2786b72b83d2e292b8d1.tar.gz |
MFhead @ r292285
Diffstat (limited to 'lib/libc/resolv/res_state.c')
-rw-r--r-- | lib/libc/resolv/res_state.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libc/resolv/res_state.c b/lib/libc/resolv/res_state.c index 87643422..6d31d92 100644 --- a/lib/libc/resolv/res_state.c +++ b/lib/libc/resolv/res_state.c @@ -37,6 +37,8 @@ #include "reentrant.h" #include "un-namespace.h" +#include "res_private.h" + #undef _res struct __res_state _res; @@ -66,20 +68,26 @@ res_check_reload(res_state statp) { struct timespec now; struct stat sb; + struct __res_state_ext *ext; + + if ((statp->options & RES_INIT) == 0) { + return (statp); + } - if ((statp->options & RES_INIT) == 0 || statp->reload_period == 0) { + ext = statp->_u._ext.ext; + if (ext == NULL || ext->reload_period == 0) { return (statp); } if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) != 0 || - (now.tv_sec - statp->conf_stat) < statp->reload_period) { + (now.tv_sec - ext->conf_stat) < ext->reload_period) { return (statp); } - statp->conf_stat = now.tv_sec; + ext->conf_stat = now.tv_sec; if (stat(_PATH_RESCONF, &sb) == 0 && - (sb.st_mtim.tv_sec != statp->conf_mtim.tv_sec || - sb.st_mtim.tv_nsec != statp->conf_mtim.tv_nsec)) { + (sb.st_mtim.tv_sec != ext->conf_mtim.tv_sec || + sb.st_mtim.tv_nsec != ext->conf_mtim.tv_nsec)) { statp->options &= ~RES_INIT; } |