summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/net/getaddrinfo.c10
-rw-r--r--src/lib/libc/net/gethostnamadr.c8
-rw-r--r--src/lib/libc/net/getnetnamadr.c8
-rw-r--r--src/lib/libc/net/getrrsetbyname.c4
-rw-r--r--src/lib/libc/net/res_debug.c8
-rw-r--r--src/lib/libc/net/res_init.c38
-rw-r--r--src/lib/libc/net/res_mkquery.c6
-rw-r--r--src/lib/libc/net/res_query.c10
-rw-r--r--src/lib/libc/net/res_send.c6
-rw-r--r--src/lib/libc/net/sethostent.c4
10 files changed, 68 insertions, 34 deletions
diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c
index c7cc0500c3..19967e8432 100644
--- a/src/lib/libc/net/getaddrinfo.c
+++ b/src/lib/libc/net/getaddrinfo.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getaddrinfo.c,v 1.51 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: getaddrinfo.c,v 1.52 2005/03/30 02:58:28 tedu Exp $ */
2/* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ 2/* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */
3 3
4/* 4/*
@@ -516,7 +516,7 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname,
516 return 0; 516 return 0;
517 } 517 }
518 518
519 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 519 if (_res_init(0) == -1)
520 strlcpy(lookups, "f", sizeof lookups); 520 strlcpy(lookups, "f", sizeof lookups);
521 else { 521 else {
522 bcopy(_resp->lookups, lookups, sizeof lookups); 522 bcopy(_resp->lookups, lookups, sizeof lookups);
@@ -1525,7 +1525,7 @@ res_queryN(const char *name, struct res_target *target)
1525 rcode = NOERROR; 1525 rcode = NOERROR;
1526 ancount = 0; 1526 ancount = 0;
1527 1527
1528 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 1528 if (_res_init(0) == -1) {
1529 h_errno = NETDB_INTERNAL; 1529 h_errno = NETDB_INTERNAL;
1530 free(buf); 1530 free(buf);
1531 return (-1); 1531 return (-1);
@@ -1631,7 +1631,7 @@ res_searchN(const char *name, struct res_target *target)
1631 int trailing_dot, ret, saved_herrno; 1631 int trailing_dot, ret, saved_herrno;
1632 int got_nodata = 0, got_servfail = 0, tried_as_is = 0; 1632 int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
1633 1633
1634 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 1634 if (_res_init(0) == -1) {
1635 h_errno = NETDB_INTERNAL; 1635 h_errno = NETDB_INTERNAL;
1636 return (-1); 1636 return (-1);
1637 } 1637 }
@@ -1768,7 +1768,7 @@ res_querydomainN(const char *name, const char *domain,
1768 const char *longname = nbuf; 1768 const char *longname = nbuf;
1769 size_t n, d; 1769 size_t n, d;
1770 1770
1771 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 1771 if (_res_init(0) == -1) {
1772 h_errno = NETDB_INTERNAL; 1772 h_errno = NETDB_INTERNAL;
1773 return (-1); 1773 return (-1);
1774 } 1774 }
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c
index 0a42d0a27e..c643f2382a 100644
--- a/src/lib/libc/net/gethostnamadr.c
+++ b/src/lib/libc/net/gethostnamadr.c
@@ -48,7 +48,7 @@
48 */ 48 */
49 49
50#if defined(LIBC_SCCS) && !defined(lint) 50#if defined(LIBC_SCCS) && !defined(lint)
51static const char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.60 2004/07/29 03:09:40 itojun Exp $"; 51static const char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.61 2005/03/30 02:58:28 tedu Exp $";
52#endif /* LIBC_SCCS and not lint */ 52#endif /* LIBC_SCCS and not lint */
53 53
54#include <sys/param.h> 54#include <sys/param.h>
@@ -479,7 +479,7 @@ gethostbyname(const char *name)
479 struct hostent *hp; 479 struct hostent *hp;
480 extern struct hostent *_gethtbyname2(const char *, int); 480 extern struct hostent *_gethtbyname2(const char *, int);
481 481
482 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 482 if (_res_init(0) == -1)
483 hp = _gethtbyname2(name, AF_INET); 483 hp = _gethtbyname2(name, AF_INET);
484 484
485 else if (_resp->options & RES_USE_INET6) { 485 else if (_resp->options & RES_USE_INET6) {
@@ -505,7 +505,7 @@ gethostbyname2(const char *name, int af)
505 extern struct hostent *_gethtbyname2(const char *, int); 505 extern struct hostent *_gethtbyname2(const char *, int);
506 extern struct hostent *_yp_gethtbyname(const char *); 506 extern struct hostent *_yp_gethtbyname(const char *);
507 507
508 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 508 if (_res_init(0) == -1)
509 return (_gethtbyname2(name, af)); 509 return (_gethtbyname2(name, af));
510 510
511 switch (af) { 511 switch (af) {
@@ -653,7 +653,7 @@ gethostbyaddr(const char *addr, int len, int af)
653 extern struct hostent *_gethtbyaddr(const char *, int, int); 653 extern struct hostent *_gethtbyaddr(const char *, int, int);
654 extern struct hostent *_yp_gethtbyaddr(const char *); 654 extern struct hostent *_yp_gethtbyaddr(const char *);
655 655
656 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 656 if (_res_init(0) == -1) {
657 res = _gethtbyaddr(addr, len, af); 657 res = _gethtbyaddr(addr, len, af);
658 return (res); 658 return (res);
659 } 659 }
diff --git a/src/lib/libc/net/getnetnamadr.c b/src/lib/libc/net/getnetnamadr.c
index 42410264b1..303ac2cc54 100644
--- a/src/lib/libc/net/getnetnamadr.c
+++ b/src/lib/libc/net/getnetnamadr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getnetnamadr.c,v 1.24 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: getnetnamadr.c,v 1.25 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997, Jason Downs. All rights reserved. 4 * Copyright (c) 1997, Jason Downs. All rights reserved.
@@ -66,7 +66,7 @@ static char sccsid[] = "@(#)getnetbyaddr.c 8.1 (Berkeley) 6/4/93";
66static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03"; 66static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03";
67static char rcsid[] = "$From: getnetnamadr.c,v 8.7 1996/08/05 08:31:35 vixie Exp $"; 67static char rcsid[] = "$From: getnetnamadr.c,v 8.7 1996/08/05 08:31:35 vixie Exp $";
68#else 68#else
69static char rcsid[] = "$OpenBSD: getnetnamadr.c,v 1.24 2005/03/25 13:24:12 otto Exp $"; 69static char rcsid[] = "$OpenBSD: getnetnamadr.c,v 1.25 2005/03/30 02:58:28 tedu Exp $";
70#endif 70#endif
71#endif /* LIBC_SCCS and not lint */ 71#endif /* LIBC_SCCS and not lint */
72 72
@@ -259,7 +259,7 @@ getnetbyaddr(in_addr_t net, int net_type)
259 char lookups[MAXDNSLUS]; 259 char lookups[MAXDNSLUS];
260 int i; 260 int i;
261 261
262 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 262 if (_res_init(0) == -1)
263 return(_getnetbyaddr(net, net_type)); 263 return(_getnetbyaddr(net, net_type));
264 264
265 bcopy(_resp->lookups, lookups, sizeof lookups); 265 bcopy(_resp->lookups, lookups, sizeof lookups);
@@ -347,7 +347,7 @@ getnetbyname(const char *net)
347 char lookups[MAXDNSLUS]; 347 char lookups[MAXDNSLUS];
348 int i; 348 int i;
349 349
350 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 350 if (_res_init(0) == -1)
351 return (_getnetbyname(net)); 351 return (_getnetbyname(net));
352 352
353 bcopy(_resp->lookups, lookups, sizeof lookups); 353 bcopy(_resp->lookups, lookups, sizeof lookups);
diff --git a/src/lib/libc/net/getrrsetbyname.c b/src/lib/libc/net/getrrsetbyname.c
index dcfc86a691..e679eb5d96 100644
--- a/src/lib/libc/net/getrrsetbyname.c
+++ b/src/lib/libc/net/getrrsetbyname.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getrrsetbyname.c,v 1.9 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: getrrsetbyname.c,v 1.10 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Jakob Schlyter. All rights reserved. 4 * Copyright (c) 2001 Jakob Schlyter. All rights reserved.
@@ -126,7 +126,7 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
126 } 126 }
127 127
128 /* initialize resolver */ 128 /* initialize resolver */
129 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 129 if (_res_init(0) == -1) {
130 result = ERRSET_FAIL; 130 result = ERRSET_FAIL;
131 goto fail; 131 goto fail;
132 } 132 }
diff --git a/src/lib/libc/net/res_debug.c b/src/lib/libc/net/res_debug.c
index 02f9e4a1ea..82a067c1f0 100644
--- a/src/lib/libc/net/res_debug.c
+++ b/src/lib/libc/net/res_debug.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_debug.c,v 1.19 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: res_debug.c,v 1.20 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1990, 1993 4 * ++Copyright++ 1985, 1990, 1993
@@ -78,7 +78,7 @@
78static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; 78static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
79static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $"; 79static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $";
80#else 80#else
81static char rcsid[] = "$OpenBSD: res_debug.c,v 1.19 2005/03/25 13:24:12 otto Exp $"; 81static char rcsid[] = "$OpenBSD: res_debug.c,v 1.20 2005/03/30 02:58:28 tedu Exp $";
82#endif 82#endif
83#endif /* LIBC_SCCS and not lint */ 83#endif /* LIBC_SCCS and not lint */
84 84
@@ -264,7 +264,7 @@ __fp_nquery(const u_char *msg, int len, FILE *file)
264 const HEADER *hp; 264 const HEADER *hp;
265 int n; 265 int n;
266 266
267 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 267 if (_res_init(0) == -1)
268 return; 268 return;
269 269
270#define TruncTest(x) if (x > endMark) goto trunc 270#define TruncTest(x) if (x > endMark) goto trunc
@@ -462,7 +462,7 @@ __p_rr(const u_char *cp, const u_char *msg, FILE *file)
462 char rrname[MAXDNAME]; /* The fqdn of this RR */ 462 char rrname[MAXDNAME]; /* The fqdn of this RR */
463 char base64_key[MAX_KEY_BASE64]; 463 char base64_key[MAX_KEY_BASE64];
464 464
465 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 465 if (_res_init(0) == -1) {
466 h_errno = NETDB_INTERNAL; 466 h_errno = NETDB_INTERNAL;
467 return (NULL); 467 return (NULL);
468 } 468 }
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c
index f4a8d31cb1..110542a404 100644
--- a/src/lib/libc/net/res_init.c
+++ b/src/lib/libc/net/res_init.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_init.c,v 1.31 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: res_init.c,v 1.32 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1989, 1993 4 * ++Copyright++ 1985, 1989, 1993
@@ -60,7 +60,7 @@
60static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; 60static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
61static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; 61static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $";
62#else 62#else
63static char rcsid[] = "$OpenBSD: res_init.c,v 1.31 2005/03/25 13:24:12 otto Exp $"; 63static char rcsid[] = "$OpenBSD: res_init.c,v 1.32 2005/03/30 02:58:28 tedu Exp $";
64#endif 64#endif
65#endif /* LIBC_SCCS and not lint */ 65#endif /* LIBC_SCCS and not lint */
66 66
@@ -68,6 +68,7 @@ static char rcsid[] = "$OpenBSD: res_init.c,v 1.31 2005/03/25 13:24:12 otto Exp
68#include <sys/param.h> 68#include <sys/param.h>
69#include <sys/socket.h> 69#include <sys/socket.h>
70#include <sys/time.h> 70#include <sys/time.h>
71#include <sys/stat.h>
71#include <netinet/in.h> 72#include <netinet/in.h>
72#include <arpa/inet.h> 73#include <arpa/inet.h>
73#include <arpa/nameser.h> 74#include <arpa/nameser.h>
@@ -131,6 +132,8 @@ void *__THREAD_NAME(_res_ext);
131struct __res_state_ext _res_ext; 132struct __res_state_ext _res_ext;
132#endif /* INET6 */ 133#endif /* INET6 */
133 134
135int __res_chktime = 30;
136
134/* 137/*
135 * Set up default settings. If the configuration file exist, the values 138 * Set up default settings. If the configuration file exist, the values
136 * there will have precedence. Otherwise, the server address is set to 139 * there will have precedence. Otherwise, the server address is set to
@@ -155,6 +158,14 @@ struct __res_state_ext _res_ext;
155int 158int
156res_init(void) 159res_init(void)
157{ 160{
161
162 return (_res_init(1));
163}
164
165int
166_res_init(int usercall)
167{
168 struct stat sb;
158 struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); 169 struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
159#ifdef INET6 170#ifdef INET6
160 struct __res_state_ext *_res_extp = _THREAD_PRIVATE(_res_ext, _res_ext, 171 struct __res_state_ext *_res_extp = _THREAD_PRIVATE(_res_ext, _res_ext,
@@ -176,6 +187,29 @@ res_init(void)
176 int dots; 187 int dots;
177#endif 188#endif
178 189
190 if (usercall == 0) {
191 if (_resp->options & RES_INIT &&
192 _resp->reschktime >= time(NULL))
193 return (0);
194 _resp->reschktime = time(NULL) + __res_chktime;
195 if (stat(_PATH_RESCONF, &sb) != -1) {
196 if (timespeccmp(&sb.st_mtimespec,
197 &_resp->restimespec, ==))
198 return (0);
199 else
200 _resp->restimespec = sb.st_mtimespec;
201 } else {
202 /*
203 * Lost the file, in chroot?
204 * Don' trash settings
205 */
206 if (timespecisset(&_resp->restimespec))
207 return (0);
208 }
209 } else
210 _resp->reschktime = time(NULL) + __res_chktime;
211
212
179 /* 213 /*
180 * These three fields used to be statically initialized. This made 214 * These three fields used to be statically initialized. This made
181 * it hard to use this code in a shared library. It is necessary, 215 * it hard to use this code in a shared library. It is necessary,
diff --git a/src/lib/libc/net/res_mkquery.c b/src/lib/libc/net/res_mkquery.c
index 28ae92056d..a6c37379f9 100644
--- a/src/lib/libc/net/res_mkquery.c
+++ b/src/lib/libc/net/res_mkquery.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_mkquery.c,v 1.15 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: res_mkquery.c,v 1.16 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1993 4 * ++Copyright++ 1985, 1993
@@ -56,7 +56,7 @@
56static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; 56static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
57static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; 57static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $";
58#else 58#else
59static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.15 2005/03/25 13:24:12 otto Exp $"; 59static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.16 2005/03/30 02:58:28 tedu Exp $";
60#endif 60#endif
61#endif /* LIBC_SCCS and not lint */ 61#endif /* LIBC_SCCS and not lint */
62 62
@@ -94,7 +94,7 @@ res_mkquery(int op,
94 int n; 94 int n;
95 u_char *dnptrs[20], **dpp, **lastdnptr; 95 u_char *dnptrs[20], **dpp, **lastdnptr;
96 96
97 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 97 if (_res_init(0) == -1) {
98 h_errno = NETDB_INTERNAL; 98 h_errno = NETDB_INTERNAL;
99 return (-1); 99 return (-1);
100 } 100 }
diff --git a/src/lib/libc/net/res_query.c b/src/lib/libc/net/res_query.c
index 677c411a6e..4af1651cf1 100644
--- a/src/lib/libc/net/res_query.c
+++ b/src/lib/libc/net/res_query.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_query.c,v 1.22 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: res_query.c,v 1.23 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1988, 1993 4 * ++Copyright++ 1988, 1993
@@ -56,7 +56,7 @@
56static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; 56static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
57static char rcsid[] = "$From: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $"; 57static char rcsid[] = "$From: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $";
58#else 58#else
59static char rcsid[] = "$OpenBSD: res_query.c,v 1.22 2005/03/25 13:24:12 otto Exp $"; 59static char rcsid[] = "$OpenBSD: res_query.c,v 1.23 2005/03/30 02:58:28 tedu Exp $";
60#endif 60#endif
61#endif /* LIBC_SCCS and not lint */ 61#endif /* LIBC_SCCS and not lint */
62 62
@@ -111,7 +111,7 @@ res_query(const char *name,
111 111
112 hp->rcode = NOERROR; /* default */ 112 hp->rcode = NOERROR; /* default */
113 113
114 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 114 if (_res_init(0) == -1) {
115 h_errno = NETDB_INTERNAL; 115 h_errno = NETDB_INTERNAL;
116 return (-1); 116 return (-1);
117 } 117 }
@@ -193,7 +193,7 @@ res_search(const char *name,
193 int trailing_dot, ret, saved_herrno; 193 int trailing_dot, ret, saved_herrno;
194 int got_nodata = 0, got_servfail = 0, tried_as_is = 0; 194 int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
195 195
196 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 196 if (_res_init(0) == -1) {
197 h_errno = NETDB_INTERNAL; 197 h_errno = NETDB_INTERNAL;
198 return (-1); 198 return (-1);
199 } 199 }
@@ -332,7 +332,7 @@ res_querydomain(const char *name,
332 const char *longname = nbuf; 332 const char *longname = nbuf;
333 int n; 333 int n;
334 334
335 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 335 if (_res_init(0) == -1) {
336 h_errno = NETDB_INTERNAL; 336 h_errno = NETDB_INTERNAL;
337 return (-1); 337 return (-1);
338 } 338 }
diff --git a/src/lib/libc/net/res_send.c b/src/lib/libc/net/res_send.c
index 04eb268d90..ee7ce43035 100644
--- a/src/lib/libc/net/res_send.c
+++ b/src/lib/libc/net/res_send.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_send.c,v 1.17 2005/03/25 13:24:12 otto Exp $ */ 1/* $OpenBSD: res_send.c,v 1.18 2005/03/30 02:58:28 tedu Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1989, 1993 4 * ++Copyright++ 1985, 1989, 1993
@@ -60,7 +60,7 @@
60static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; 60static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
61static char rcsid[] = "$From: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $"; 61static char rcsid[] = "$From: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $";
62#else 62#else
63static char rcsid[] = "$OpenBSD: res_send.c,v 1.17 2005/03/25 13:24:12 otto Exp $"; 63static char rcsid[] = "$OpenBSD: res_send.c,v 1.18 2005/03/30 02:58:28 tedu Exp $";
64#endif 64#endif
65#endif /* LIBC_SCCS and not lint */ 65#endif /* LIBC_SCCS and not lint */
66 66
@@ -343,7 +343,7 @@ res_send(const u_char *buf, int buflen, u_char *ans, int anssiz)
343 int n; 343 int n;
344 u_int badns; /* XXX NSMAX can't exceed #/bits in this var */ 344 u_int badns; /* XXX NSMAX can't exceed #/bits in this var */
345 345
346 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { 346 if (_res_init(0) == -1) {
347 /* errno should have been set by res_init() in this case. */ 347 /* errno should have been set by res_init() in this case. */
348 return (-1); 348 return (-1);
349 } 349 }
diff --git a/src/lib/libc/net/sethostent.c b/src/lib/libc/net/sethostent.c
index 2140d65d08..c0eae942ca 100644
--- a/src/lib/libc/net/sethostent.c
+++ b/src/lib/libc/net/sethostent.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char rcsid[] = "$OpenBSD: sethostent.c,v 1.7 2005/03/25 13:24:12 otto Exp $"; 31static char rcsid[] = "$OpenBSD: sethostent.c,v 1.8 2005/03/30 02:58:28 tedu Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/param.h> 34#include <sys/param.h>
@@ -44,7 +44,7 @@ sethostent(int stayopen)
44{ 44{
45 struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); 45 struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
46 46
47 if ((_resp->options & RES_INIT) == 0 && res_init() == -1) 47 if (_res_init(0) == -1)
48 return; 48 return;
49 if (stayopen) 49 if (stayopen)
50 _resp->options |= RES_STAYOPEN | RES_USEVC; 50 _resp->options |= RES_STAYOPEN | RES_USEVC;