summaryrefslogtreecommitdiffstats
path: root/lib/libc/resolv/res_data.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2014-08-30 10:16:25 +0000
committerume <ume@FreeBSD.org>2014-08-30 10:16:25 +0000
commit7642dd9269b5e4ac7a60c333921d606f62925a5a (patch)
tree3d3bc3eb7ea30467632ad8ae097b2ee653990edb /lib/libc/resolv/res_data.c
parent80004c0874fc6f974f7940f2c3148eaa440d04f4 (diff)
downloadFreeBSD-src-7642dd9269b5e4ac7a60c333921d606f62925a5a.zip
FreeBSD-src-7642dd9269b5e4ac7a60c333921d606f62925a5a.tar.gz
MFC r269867:
Update our stub resolver to final version of libbind (libbind-6.0). Obtained from: ISC
Diffstat (limited to 'lib/libc/resolv/res_data.c')
-rw-r--r--lib/libc/resolv/res_data.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/libc/resolv/res_data.c b/lib/libc/resolv/res_data.c
index 5a1a50c..f020838 100644
--- a/lib/libc/resolv/res_data.c
+++ b/lib/libc/resolv/res_data.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: res_data.c,v 1.3.18.2 2007/09/14 05:35:47 marka Exp $";
+static const char rcsid[] = "$Id: res_data.c,v 1.7 2008/12/11 09:59:00 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -107,13 +107,6 @@ res_init(void) {
if (!(_res.options & RES_INIT))
_res.options = RES_DEFAULT;
- /*
- * This one used to initialize implicitly to zero, so unless the app
- * has set it to something in particular, we can randomize it now.
- */
- if (!_res.id)
- _res.id = res_randomid();
-
return (__res_vinit(&_res, 1));
}
@@ -264,6 +257,16 @@ res_querydomain(const char *name,
answer, anslen));
}
+u_int
+res_randomid(void) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nrandomid(&_res));
+}
+
int
res_opt(int n0, u_char *buf, int buflen, int anslen)
{
OpenPOWER on IntegriCloud