summaryrefslogtreecommitdiff
path: root/usr/src/lib/libresolv/res_send.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libresolv/res_send.c')
-rw-r--r--usr/src/lib/libresolv/res_send.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/usr/src/lib/libresolv/res_send.c b/usr/src/lib/libresolv/res_send.c
index 89a602f6d2..4d304763e3 100644
--- a/usr/src/lib/libresolv/res_send.c
+++ b/usr/src/lib/libresolv/res_send.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -122,6 +122,7 @@ static int _confcheck()
return (0);
}
+int
res_send(buf, buflen, answer, anslen)
char *buf;
int buflen;
@@ -147,7 +148,7 @@ res_send(buf, buflen, answer, anslen)
printf("res_send()\n");
p_query(buf);
}
-#endif DEBUG
+#endif
if (!(_res.options & RES_INIT))
if (res_init() == -1) {
return (-1);
@@ -168,7 +169,7 @@ res_send(buf, buflen, answer, anslen)
if (_res.options & RES_DEBUG)
printf("Querying server (# %d) address = %s\n",
ns+1, inet_ntoa(_res.nsaddr_list[ns].sin_addr));
-#endif DEBUG
+#endif
usevc:
if (v_circuit) {
int truncated = 0;
@@ -186,7 +187,7 @@ res_send(buf, buflen, answer, anslen)
if (_res.options & RES_DEBUG) {
perror("socket (vc) failed");
}
-#endif DEBUG
+#endif
continue;
}
if (connect(s, (struct sockaddr *) &_res.nsaddr_list[ns],
@@ -196,7 +197,7 @@ res_send(buf, buflen, answer, anslen)
if (_res.options & RES_DEBUG) {
perror("connect failed");
}
-#endif DEBUG
+#endif
(void) close(s);
s = -1;
continue;
@@ -216,7 +217,7 @@ res_send(buf, buflen, answer, anslen)
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("write failed");
-#endif DEBUG
+#endif
(void) close(s);
s = -1;
continue;
@@ -236,7 +237,7 @@ res_send(buf, buflen, answer, anslen)
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("read failed");
-#endif DEBUG
+#endif
(void) close(s);
s = -1;
/*
@@ -262,7 +263,7 @@ res_send(buf, buflen, answer, anslen)
if (_res.options & RES_DEBUG)
fprintf(stderr,
"response truncated\n");
-#endif DEBUG
+#endif
len = anslen;
truncated = 1;
} else
@@ -278,7 +279,7 @@ res_send(buf, buflen, answer, anslen)
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("read failed");
-#endif DEBUG
+#endif
(void) close(s);
s = -1;
continue;
@@ -320,7 +321,7 @@ res_send(buf, buflen, answer, anslen)
if (_res.options & RES_DEBUG) {
perror("socket (dg) failed");
}
-#endif DEBUG
+#endif
continue;
}
}
@@ -357,7 +358,7 @@ res_send(buf, buflen, answer, anslen)
RES_DEBUG) {
perror("connect");
}
-#endif DEBUG
+#endif
continue;
}
connected = 1;
@@ -366,7 +367,7 @@ res_send(buf, buflen, answer, anslen)
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("send");
-#endif DEBUG
+#endif
continue;
}
} else {
@@ -379,14 +380,14 @@ res_send(buf, buflen, answer, anslen)
sizeof (no_addr));
connected = 0;
}
-#endif BSD
+#endif /* BSD */
if (sendto(s, buf, buflen, 0,
(struct sockaddr *) &_res.nsaddr_list[ns],
sizeof (struct sockaddr)) != buflen) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("sendto");
-#endif DEBUG
+#endif
continue;
}
#if BSD >= 43
@@ -411,7 +412,7 @@ wait:
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("select");
-#endif DEBUG
+#endif
continue;
}
if (n == 0) {
@@ -421,7 +422,7 @@ wait:
#ifdef DEBUG
if (_res.options & RES_DEBUG)
printf("timeout\n");
-#endif DEBUG
+#endif
#if BSD >= 43
gotsomewhere = 1;
#endif
@@ -432,7 +433,7 @@ wait:
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("recvfrom");
-#endif DEBUG
+#endif
continue;
}
gotsomewhere = 1;
@@ -445,7 +446,7 @@ wait:
printf("old answer:\n");
p_query(answer);
}
-#endif DEBUG
+#endif
goto wait;
}
if (!(_res.options & RES_IGNTC) && anhp->tc) {
@@ -456,7 +457,7 @@ wait:
#ifdef DEBUG
if (_res.options & RES_DEBUG)
printf("truncated answer\n");
-#endif DEBUG
+#endif
(void) close(s);
s = -1;
v_circuit = 1;
@@ -468,7 +469,7 @@ wait:
printf("got answer:\n");
p_query(answer);
}
-#endif DEBUG
+#endif
/*
* If using virtual circuits, we assume that the first server
* is preferred * over the rest (i.e. it is on the local
@@ -507,6 +508,7 @@ wait:
*
* This routine is not expected to be user visible.
*/
+void
_res_close()
{
if (s != -1) {