summaryrefslogtreecommitdiffstats
path: root/lib/libc/resolv/res_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/resolv/res_state.c')
-rw-r--r--lib/libc/resolv/res_state.c18
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;
}
OpenPOWER on IntegriCloud