aboutsummaryrefslogtreecommitdiff
path: root/resolv/res_init.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-05-31 07:54:02 +0000
committerUlrich Drepper <drepper@redhat.com>2002-05-31 07:54:02 +0000
commitb64e1566263764ddc1173cfa3f94d0ef92ae2883 (patch)
tree265ef2e36521a7a8382a709b1f817fa51c0464e3 /resolv/res_init.c
parent2afdb78308bba863d275cbae0b22c51a07826af7 (diff)
downloadglibc-b64e1566263764ddc1173cfa3f94d0ef92ae2883.tar
glibc-b64e1566263764ddc1173cfa3f94d0ef92ae2883.tar.gz
glibc-b64e1566263764ddc1173cfa3f94d0ef92ae2883.tar.bz2
glibc-b64e1566263764ddc1173cfa3f94d0ef92ae2883.zip
Update.
2002-05-21 Jakub Jelinek <jakub@redhat.com> * resolv/resolv.h (struct __res_state): Remove unused nstimes. Add nsmap. * resolv/res_init.c (__res_vinit): Initialize nsmap array. Remove nstimes setting. (res_nclose): Check all MAXNS nameservers with non-NULL nsaddrs. * resolv/res_send.c (res_nsend): Don't close unconditionally if there is mix of IPv6 and IPv4 nameservers. Use nsmap array to find free slots and preserve nameserver ordering. Fix RES_ROTATE.
Diffstat (limited to 'resolv/res_init.c')
-rw-r--r--resolv/res_init.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/resolv/res_init.c b/resolv/res_init.c
index bb66b02b6c..f5613825bf 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -182,8 +182,10 @@ __res_vinit(res_state statp, int preinit) {
statp->_u._ext.nscount = 0;
#ifdef _LIBC
statp->_u._ext.nscount6 = 0;
- for (n = 0; n < MAXNS; n++)
- statp->_u._ext.nsaddrs[n] = NULL;
+ for (n = 0; n < MAXNS; n++) {
+ statp->_u._ext.nsaddrs[n] = NULL;
+ statp->_u._ext.nsmap[n] = MAXNS;
+ }
#endif
/* Allow user to override the local domain definition */
@@ -323,8 +325,8 @@ __res_vinit(res_state statp, int preinit) {
sa6->sin6_family = AF_INET6;
sa6->sin6_port = htons(NAMESERVER_PORT);
statp->_u._ext.nsaddrs[nservall] = sa6;
- statp->_u._ext.nstimes[nservall] = RES_MAXTIME;
statp->_u._ext.nssocks[nservall] = -1;
+ statp->_u._ext.nsmap[nservall] = MAXNS + 1;
nservall++;
}
}
@@ -537,16 +539,14 @@ res_nclose(res_state statp) {
statp->_flags &= ~(RES_F_VC | RES_F_CONN);
}
#ifdef _LIBC
- for (ns = 0; ns < statp->_u._ext.nscount + statp->_u._ext.nscount6;
- ns++)
+ for (ns = 0; ns < MAXNS; ns++)
#else
for (ns = 0; ns < statp->_u._ext.nscount; ns++)
#endif
- {
- if (statp->_u._ext.nssocks[ns] != -1) {
+ if (statp->_u._ext.nsaddrs[ns]
+ && statp->_u._ext.nssocks[ns] != -1) {
(void) __close(statp->_u._ext.nssocks[ns]);
statp->_u._ext.nssocks[ns] = -1;
}
- }
statp->_u._ext.nsinit = 0;
}