Page MenuHomeFreeBSD

D4472.id10984.diff
No OneTemporary

D4472.id10984.diff

Index: include/resolv.h
===================================================================
--- include/resolv.h
+++ include/resolv.h
@@ -57,7 +57,6 @@
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/socket.h>
-#include <sys/timespec.h>
#include <stdio.h>
#include <arpa/nameser.h>
@@ -190,8 +189,6 @@
} _ext;
} _u;
u_char *_rnd; /*%< PRIVATE: random state */
- struct timespec conf_mtim; /*%< mod time of loaded resolv.conf */
- time_t conf_stat; /*%< time of last stat(resolv.conf) */
};
typedef struct __res_state *res_state;
Index: lib/libc/resolv/res_init.c
===================================================================
--- lib/libc/resolv/res_init.c
+++ lib/libc/resolv/res_init.c
@@ -326,17 +326,19 @@
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;
+ 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->_u._ext.ext->conf_stat = 0;
+ }
} else {
- statp->conf_stat = 0;
+ statp->_u._ext.ext->conf_mtim.tv_sec = 0;
+ statp->_u._ext.ext->conf_mtim.tv_nsec = 0;
+ statp->_u._ext.ext->conf_stat = 0;
}
- } else {
- statp->conf_mtim.tv_sec = 0;
- statp->conf_mtim.tv_nsec = 0;
- statp->conf_stat = 0;
}
/* read the config file */
Index: lib/libc/resolv/res_private.h
===================================================================
--- lib/libc/resolv/res_private.h
+++ lib/libc/resolv/res_private.h
@@ -12,6 +12,8 @@
} sort_list[MAXRESOLVSORT];
char nsuffix[64];
char nsuffix2[64];
+ struct timespec conf_mtim; /* mod time of loaded resolv.conf */
+ time_t conf_stat; /* time of last stat(resolv.conf) */
};
extern int
Index: lib/libc/resolv/res_state.c
===================================================================
--- lib/libc/resolv/res_state.c
+++ 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,27 @@
{
struct timespec now;
struct stat sb;
+ struct __res_state_ext* ext;
if ((statp->options & RES_INIT) == 0 || statp->reload_period == 0) {
return (statp);
}
+ ext = statp->_u._ext.ext;
+ if (ext == NULL) {
+ /* Should we unset RES_INIT so we try to recover? */
+ 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) < statp->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;
}

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 29, 6:38 AM (15 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30514957
Default Alt Text
D4472.id10984.diff (3 KB)

Event Timeline