summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/resolv/res_init.c
diff options
context:
space:
mode:
authorasmodai <asmodai@FreeBSD.org>2000-05-26 07:17:19 +0000
committerasmodai <asmodai@FreeBSD.org>2000-05-26 07:17:19 +0000
commit3f83b2963e3f1302f6507d3968aa3bfc93d7472d (patch)
tree58c578d1f5a84acb9535b8fc95abe2637662f30f /contrib/bind/lib/resolv/res_init.c
parent08dfda8209739c209911999e8c76d369945766ed (diff)
downloadFreeBSD-src-3f83b2963e3f1302f6507d3968aa3bfc93d7472d.zip
FreeBSD-src-3f83b2963e3f1302f6507d3968aa3bfc93d7472d.tar.gz
Virgin import of BIND v8.2.3-T5B
Diffstat (limited to 'contrib/bind/lib/resolv/res_init.c')
-rw-r--r--contrib/bind/lib/resolv/res_init.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/contrib/bind/lib/resolv/res_init.c b/contrib/bind/lib/resolv/res_init.c
index 85dc7e3..12d9969 100644
--- a/contrib/bind/lib/resolv/res_init.c
+++ b/contrib/bind/lib/resolv/res_init.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 8.13 1999/10/13 16:39:40 vixie Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 8.16 2000/05/09 07:10:12 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -95,7 +95,6 @@ static const char rcsid[] = "$Id: res_init.c,v 8.13 1999/10/13 16:39:40 vixie Ex
/* Options. Should all be left alone. */
#define RESOLVSORT
-#define RFC1535
#define DEBUG
static void res_setoptions __P((res_state, const char *, const char *));
@@ -156,9 +155,7 @@ __res_vinit(res_state statp, int preinit) {
int nsort = 0;
char *net;
#endif
-#ifndef RFC1535
int dots;
-#endif
if (!preinit) {
statp->retrans = RES_TIMEOUT;
@@ -177,10 +174,11 @@ __res_vinit(res_state statp, int preinit) {
statp->nscount = 1;
statp->ndots = 1;
statp->pfcode = 0;
- statp->_sock = -1;
+ statp->_vcsock = -1;
statp->_flags = 0;
statp->qhook = NULL;
statp->rhook = NULL;
+ statp->_u._ext.nscount = 0;
/* Allow user to override the local domain definition */
if ((cp = getenv("LOCALDOMAIN")) != NULL) {
@@ -363,7 +361,6 @@ __res_vinit(res_state statp, int preinit) {
*pp++ = statp->defdname;
*pp = NULL;
-#ifndef RFC1535
dots = 0;
for (cp = statp->defdname; *cp; cp++)
dots += (*cp == '.');
@@ -385,7 +382,6 @@ __res_vinit(res_state statp, int preinit) {
printf(";;\t..END..\n");
}
#endif
-#endif /* !RFC1535 */
}
if ((cp = getenv("RES_OPTIONS")) != NULL)
@@ -479,3 +475,28 @@ res_randomid(void) {
gettimeofday(&now, NULL);
return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
}
+
+/*
+ * This routine is for closing the socket if a virtual circuit is used and
+ * the program wants to close it. This provides support for endhostent()
+ * which expects to close the socket.
+ *
+ * This routine is not expected to be user visible.
+ */
+void
+res_nclose(res_state statp) {
+ int ns;
+
+ if (statp->_vcsock >= 0) {
+ (void) close(statp->_vcsock);
+ statp->_vcsock = -1;
+ statp->_flags &= ~(RES_F_VC | RES_F_CONN);
+ }
+ for (ns = 0; ns < statp->_u._ext.nscount; ns++) {
+ if (statp->_u._ext.nssocks[ns] != -1) {
+ (void) close(statp->_u._ext.nssocks[ns]);
+ statp->_u._ext.nssocks[ns] = -1;
+ }
+ }
+ statp->_u._ext.nscount = 0;
+}
OpenPOWER on IntegriCloud