about summary refs log tree commit diff
path: root/resolv/res_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'resolv/res_data.c')
-rw-r--r--resolv/res_data.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/resolv/res_data.c b/resolv/res_data.c
index 7488ba7772..2183e022c8 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -141,7 +141,7 @@ fp_query(const u_char *msg, FILE *file) {
 
 void
 fp_nquery(const u_char *msg, int len, FILE *file) {
-	if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) == -1)
+	if (__res_maybe_init (&_res, 0) == -1)
 		return;
 
 	res_pquery(&_res, msg, len, file);
@@ -157,7 +157,7 @@ res_mkquery(int op,			/* opcode of query */
 	    u_char *buf,		/* buffer to put query */
 	    int buflen)			/* size of buffer */
 {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
 		return (-1);
 	}
@@ -169,7 +169,7 @@ res_mkquery(int op,			/* opcode of query */
 #ifdef BIND_UPDATE
 int
 res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
 		return (-1);
 	}
@@ -184,7 +184,7 @@ res_query(const char *name,	/* domain name */
 	  u_char *answer,	/* buffer to put answer */
 	  int anslen)		/* size of answer buffer */
 {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
 		return (-1);
 	}
@@ -208,7 +208,7 @@ res_isourserver(const struct sockaddr_in *inp) {
 
 int
 res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		/* errno should have been set by res_init() in this case. */
 		return (-1);
 	}
@@ -221,7 +221,7 @@ int
 res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key,
 	       u_char *ans, int anssiz)
 {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		/* errno should have been set by res_init() in this case. */
 		return (-1);
 	}
@@ -249,7 +249,7 @@ res_close(void) {
 #ifdef BIND_UPDATE
 int
 res_update(ns_updrec *rrecp_in) {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
 		return (-1);
 	}
@@ -264,7 +264,7 @@ res_search(const char *name,	/* domain name */
 	   u_char *answer,	/* buffer to put answer */
 	   int anslen)		/* size of answer */
 {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
 		return (-1);
 	}
@@ -279,7 +279,7 @@ res_querydomain(const char *name,
 		u_char *answer,		/* buffer to put answer */
 		int anslen)		/* size of answer */
 {
-	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+	if (__res_maybe_init (&_res, 1) == -1) {
 		RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
 		return (-1);
 	}