Fix DEBUG statements in resolv/res_send.c

This commit is contained in:
Yann Droneaud 2010-03-05 16:52:31 -08:00 committed by Ulrich Drepper
parent 66f1b8eeb2
commit a092b645f8
2 changed files with 26 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2010-02-18 Yann Droneaud <yann@droneaud.fr>
* resolv/res_send.c: Fixed DEBUG statements.
Moved tmpbuf declaration to block beginning and
updated pointer names used in multiple DprintQ() calls
2010-02-18 H.J. Lu <hongjiu.lu@intel.com> 2010-02-18 H.J. Lu <hongjiu.lu@intel.com>
* config.make.in (config-asflags-i686): Define. * config.make.in (config-asflags-i686): Define.

View File

@ -490,6 +490,9 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
for (try = 0; try < statp->retry; try++) { for (try = 0; try < statp->retry; try++) {
for (ns = 0; ns < MAXNS; ns++) for (ns = 0; ns < MAXNS; ns++)
{ {
#ifdef DEBUG
char tmpbuf[40];
#endif
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
if (nsap == NULL) if (nsap == NULL)
@ -530,9 +533,6 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
} }
#endif #endif
#ifdef DEBUG
char tmpbuf[40];
#endif
Dprint(statp->options & RES_DEBUG, Dprint(statp->options & RES_DEBUG,
(stdout, ";; Querying server (# %d) address = %s\n", (stdout, ";; Querying server (# %d) address = %s\n",
ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr, ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr,
@ -575,11 +575,12 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
(statp->pfcode & RES_PRF_REPLY), (statp->pfcode & RES_PRF_REPLY),
(stdout, "%s", ""), (stdout, "%s", ""),
ans, (resplen > anssiz) ? anssiz : resplen); ans, (resplen > anssiz) ? anssiz : resplen);
if (buf2 != NULL) if (buf2 != NULL) {
DprintQ((statp->options & RES_DEBUG) || DprintQ((statp->options & RES_DEBUG) ||
(statp->pfcode & RES_PRF_REPLY), (statp->pfcode & RES_PRF_REPLY),
(stdout, "%s", ""), (stdout, "%s", ""),
*ansp2, (*resplen2 > *nansp2) ? *nansp2 : *resplen2); *ansp2, (*resplen2 > *nansp2) ? *nansp2 : *resplen2);
}
/* /*
* If we have temporarily opened a virtual circuit, * If we have temporarily opened a virtual circuit,
@ -883,7 +884,7 @@ send_vc(res_state statp,
(statp->pfcode & RES_PRF_REPLY), (statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer (unexpected):\n"), (stdout, ";; old answer (unexpected):\n"),
*thisansp, *thisansp,
(rlen > *thisanssiz) ? *thisanssiz: rlen); (rlen > *thisanssizp) ? *thisanssizp: rlen);
goto read_len; goto read_len;
} }
@ -1186,7 +1187,7 @@ send_dg(res_state statp,
*/ */
Dprint(statp->options & RES_DEBUG, Dprint(statp->options & RES_DEBUG,
(stdout, ";; undersized: %d\n", (stdout, ";; undersized: %d\n",
*thisresplen)); *thisresplenp));
*terrno = EMSGSIZE; *terrno = EMSGSIZE;
goto err_out; goto err_out;
} }
@ -1201,8 +1202,8 @@ send_dg(res_state statp,
(statp->pfcode & RES_PRF_REPLY), (statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer:\n"), (stdout, ";; old answer:\n"),
thisansp, thisansp,
(*thisresplen > *thisanssiz) (*thisresplenp > *thisanssizp)
? *thisanssiz : *thisresplen); ? *thisanssizp : *thisresplenp);
goto wait; goto wait;
} }
if (!(statp->options & RES_INSECURE1) && if (!(statp->options & RES_INSECURE1) &&
@ -1216,8 +1217,8 @@ send_dg(res_state statp,
(statp->pfcode & RES_PRF_REPLY), (statp->pfcode & RES_PRF_REPLY),
(stdout, ";; not our server:\n"), (stdout, ";; not our server:\n"),
thisansp, thisansp,
(*thisresplen > *thisanssiz) (*thisresplenp > *thisanssizp)
? *thisanssiz : *thisresplen); ? *thisanssizp : *thisresplenp);
goto wait; goto wait;
} }
#ifdef RES_USE_EDNS0 #ifdef RES_USE_EDNS0
@ -1232,9 +1233,9 @@ send_dg(res_state statp,
DprintQ(statp->options & RES_DEBUG, DprintQ(statp->options & RES_DEBUG,
(stdout, (stdout,
"server rejected query with EDNS0:\n"), "server rejected query with EDNS0:\n"),
thisans, thisansp,
(*thisresplen > *thisanssiz) (*thisresplenp > *thisanssizp)
? *thisanssiz : *thisresplen); ? *thisanssizp : *thisresplenp);
/* record the error */ /* record the error */
statp->_flags |= RES_F_EDNS0ERR; statp->_flags |= RES_F_EDNS0ERR;
goto err_out; goto err_out;
@ -1258,8 +1259,8 @@ send_dg(res_state statp,
(statp->pfcode & RES_PRF_REPLY), (statp->pfcode & RES_PRF_REPLY),
(stdout, ";; wrong query name:\n"), (stdout, ";; wrong query name:\n"),
thisansp, thisansp,
(*thisresplen > *thisanssiz) (*thisresplenp > *thisanssizp)
? *thisanssiz : *thisresplen); ? *thisanssizp : *thisresplenp);
goto wait; goto wait;
} }
if (anhp->rcode == SERVFAIL || if (anhp->rcode == SERVFAIL ||
@ -1268,8 +1269,8 @@ send_dg(res_state statp,
DprintQ(statp->options & RES_DEBUG, DprintQ(statp->options & RES_DEBUG,
(stdout, "server rejected query:\n"), (stdout, "server rejected query:\n"),
thisansp, thisansp,
(*thisresplen > *thisanssiz) (*thisresplenp > *thisanssizp)
? *thisanssiz : *thisresplen); ? *thisanssizp : *thisresplenp);
if (recvresp1 || (buf2 != NULL && recvresp2)) if (recvresp1 || (buf2 != NULL && recvresp2))
return resplen; return resplen;
@ -1295,8 +1296,8 @@ send_dg(res_state statp,
DprintQ(statp->options & RES_DEBUG, DprintQ(statp->options & RES_DEBUG,
(stdout, "referred query:\n"), (stdout, "referred query:\n"),
thisansp, thisansp,
(*thisresplen > *thisanssiz) (*thisresplenp > *thisanssizp)
? *thisanssiz : *thisresplen); ? *thisanssizp : *thisresplenp);
goto next_ns; goto next_ns;
} }
if (!(statp->options & RES_IGNTC) && anhp->tc) { if (!(statp->options & RES_IGNTC) && anhp->tc) {