aboutsummaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/res_init.c3
-rw-r--r--resolv/res_send.c5
-rw-r--r--resolv/resolv.h1
3 files changed, 6 insertions, 3 deletions
diff --git a/resolv/res_init.c b/resolv/res_init.c
index fa60b77c81..1b14f94e76 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -177,6 +177,7 @@ __res_vinit(res_state statp, int preinit) {
statp->_flags = 0;
statp->qhook = NULL;
statp->rhook = NULL;
+ statp->_u._ext.nsinit = 0;
statp->_u._ext.nscount = 0;
#ifdef _LIBC
statp->_u._ext.nscount6 = 0;
@@ -544,5 +545,5 @@ res_nclose(res_state statp) {
statp->_u._ext.nssocks[ns] = -1;
}
}
- statp->_u._ext.nscount = 0;
+ statp->_u._ext.nsinit = 0;
}
diff --git a/resolv/res_send.c b/resolv/res_send.c
index cc9fd0070d..751a5506a1 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -394,7 +394,7 @@ res_nsend(res_state statp,
* If the ns_addr_list in the resolver context has changed, then
* invalidate our cached copy and the associated timing data.
*/
- if (EXT(statp).nscount != 0) {
+ if (EXT(statp).nsinit) {
int needclose = 0;
if (EXT(statp).nscount != statp->nscount)
@@ -420,7 +420,7 @@ res_nsend(res_state statp,
/*
* Maybe initialize our private copy of the ns_addr_list.
*/
- if (EXT(statp).nscount == 0) {
+ if (EXT(statp).nsinit == 0) {
#ifdef _LIBC
n = 0;
#endif
@@ -454,6 +454,7 @@ res_nsend(res_state statp,
#endif
}
EXT(statp).nscount = statp->nscount;
+ EXT(statp).nsinit = 1;
#ifdef _LIBC
/* If holes left, free memory and set to NULL */
while (n < MAXNS) {
diff --git a/resolv/resolv.h b/resolv/resolv.h
index 6677adde3b..bb8c782939 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -154,6 +154,7 @@ struct __res_state {
u_int16_t nstimes[MAXNS]; /* ms. */
int nssocks[MAXNS];
u_int16_t nscount6;
+ u_int16_t nsinit;
struct sockaddr_in6 *nsaddrs[MAXNS];
} _ext;
} _u;