aboutsummaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-09 00:25:37 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-09 00:25:37 +0000
commit020a9a23e2eff7479ccdc6a9fc11c7572925baae (patch)
tree6d37d46fe95333cb3d26eed79f7a594f367ee50a /resolv
parent0b3cce3139d2cb17328c1fdd80789304250b5be3 (diff)
downloadglibc-020a9a23e2eff7479ccdc6a9fc11c7572925baae.zip
glibc-020a9a23e2eff7479ccdc6a9fc11c7572925baae.tar.gz
glibc-020a9a23e2eff7479ccdc6a9fc11c7572925baae.tar.bz2
Update.
* resolv/res_send.c: Compiling with DEBUG defined works again. * resolv/gethnamaddr.c (dprintf): Renamed to Dprintf. Adjust all callers.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/gethnamaddr.c12
-rw-r--r--resolv/res_send.c33
2 files changed, 30 insertions, 15 deletions
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index a02d0fb..42d81f3 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -143,7 +143,7 @@ extern int h_errno;
#ifdef DEBUG
static void
-dprintf(msg, num)
+Dprintf(msg, num)
char *msg;
int num;
{
@@ -155,7 +155,7 @@ dprintf(msg, num)
}
}
#else
-# define dprintf(msg, num) /*nada*/
+# define Dprintf(msg, num) /*nada*/
#endif
#define BOUNDED_INCR(x) \
@@ -429,13 +429,13 @@ getanswer(answer, anslen, qname, qtype)
bp += sizeof(align) - ((u_long)bp % sizeof(align));
if (bp + n >= &hostbuf[sizeof hostbuf]) {
- dprintf("size (%d) too big\n", n);
+ Dprintf("size (%d) too big\n", n);
had_error++;
continue;
}
if (hap >= &h_addr_ptrs[MAXADDRS-1]) {
if (!toobig++) {
- dprintf("Too many addresses (%d)\n",
+ Dprintf("Too many addresses (%d)\n",
MAXADDRS);
}
cp += n;
@@ -627,7 +627,7 @@ gethostbyname2(name, af)
&buf.ptr)) < 0) {
if (buf.buf != origbuf)
free (buf.buf);
- dprintf("res_nsearch failed (%d)\n", n);
+ Dprintf("res_nsearch failed (%d)\n", n);
if (errno == ECONNREFUSED)
return (_gethtbyname2(name, af));
return (NULL);
@@ -729,7 +729,7 @@ gethostbyaddr(addr, len, af)
if (n < 0) {
if (buf.buf != orig_buf)
free (buf.buf);
- dprintf("res_nquery failed (%d)\n", n);
+ Dprintf("res_nquery failed (%d)\n", n);
if (errno == ECONNREFUSED)
return (_gethtbyaddr(addr, len, af));
return (NULL);
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 19adc3e..54f74d4 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -190,7 +190,7 @@ static int send_dg(res_state, const u_char *, int,
int *, int *, u_char **);
#ifdef DEBUG
static void Aerror(const res_state, FILE *, const char *, int,
- struct sockaddr_in);
+ const struct sockaddr *);
static void Perror(const res_state, FILE *, const char *, int);
#endif
#ifdef _LIBC
@@ -576,9 +576,17 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
} while (!done);
}
+#ifdef _LIBC
+ char tmpbuf[40];
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; Querying server (# %d) address = %s\n",
+ ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr,
+ tmpbuf, sizeof (tmpbuf))));
+#else
Dprint(statp->options & RES_DEBUG,
(stdout, ";; Querying server (# %d) address = %s\n",
ns + 1, inet_ntoa(nsap->sin_addr)));
+#endif
if (v_circuit) {
/* Use VC; at most one attempt per server. */
@@ -610,7 +618,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
DprintQ((statp->options & RES_DEBUG) ||
(statp->pfcode & RES_PRF_REPLY),
- (stdout, ""),
+ (stdout, "%s", ""),
ans, (resplen > anssiz) ? anssiz : resplen);
/*
@@ -743,7 +751,8 @@ send_vc(res_state statp,
if (connect(statp->_vcsock, (struct sockaddr *)nsap,
sizeof *nsap) < 0) {
*terrno = errno;
- Aerror(statp, stderr, "connect/vc", errno, *nsap);
+ Aerror(statp, stderr, "connect/vc", errno,
+ (struct sockaddr *) nsap);
res_nclose(statp);
return (0);
}
@@ -948,7 +957,8 @@ send_dg(res_state statp,
*/
if (connect(EXT(statp).nssocks[ns], (struct sockaddr *)nsap,
sizeof *nsap) < 0) {
- Aerror(statp, stderr, "connect(dg)", errno, *nsap);
+ Aerror(statp, stderr, "connect(dg)", errno,
+ (struct sockaddr *) nsap);
res_nclose(statp);
return (0);
}
@@ -972,7 +982,8 @@ send_dg(res_state statp,
if (sendto(s, (char*)buf, buflen, 0,
(struct sockaddr *)nsap, sizeof *nsap) != buflen)
{
- Aerror(statp, stderr, "sendto", errno, *nsap);
+ Aerror(statp, stderr, "sendto", errno,
+ (struct sockaddr *) nsap);
res_nclose(statp);
return (0);
}
@@ -1130,18 +1141,22 @@ send_dg(res_state statp,
#ifdef DEBUG
static void
Aerror(const res_state statp, FILE *file, const char *string, int error,
- struct sockaddr_in address)
+ const struct sockaddr *address)
{
int save = errno;
if ((statp->options & RES_DEBUG) != 0) {
- char tmp[sizeof "255.255.255.255"];
+ char tmp[sizeof "xxxx.xxxx.xxxx.255.255.255.255"];
fprintf(file, "res_send: %s ([%s].%u): %s\n",
string,
- inet_ntop(address.sin_family, &address.sin_addr,
+ inet_ntop(address->sa_family, address->sa_data,
tmp, sizeof tmp),
- ntohs(address.sin_port),
+ (address->sa_family == AF_INET
+ ? ntohs(((struct sockaddr_in *) address)->sin_port)
+ : address->sa_family == AF_INET6
+ ? ntohs(((struct sockaddr_in6 *) address)->sin6_port)
+ : 0),
strerror(error));
}
__set_errno (save);