From: Ken Raeburn Date: Sat, 28 Aug 2004 00:25:24 +0000 (+0000) Subject: move last patch down a little so it applies to tcp sockets as well as udp X-Git-Tag: krb5-1.4-beta1~117 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ed0af72223f05ff128735f796814f1da702866f5;p=krb5.git move last patch down a little so it applies to tcp sockets as well as udp git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16695 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 47cc2bce8..599c28515 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -632,23 +632,24 @@ start_connection (struct conn_state *state, struct select_state *selstate) state->state = FAILED; return -3; } else { -#ifdef DEBUG - struct sockaddr_storage ss; - socklen_t sslen = sizeof(ss); - if (0 == getsockname(state->fd, (struct sockaddr *) &ss, &sslen)) { - struct addrinfo hack_ai; - memset(&hack_ai, 0, sizeof(hack_ai)); - hack_ai.ai_addr = (struct sockaddr *) &ss; - hack_ai.ai_addrlen = sslen; - hack_ai.ai_socktype = SOCK_DGRAM; - hack_ai.ai_family = ai->ai_family; - dprint("local address used was %A\n", &hack_ai); - } -#endif state->state = READING; } } - +#ifdef DEBUG + if (debug) { + struct sockaddr_storage ss; + socklen_t sslen = sizeof(ss); + if (getsockname(state->fd, (struct sockaddr *)&ss, &sslen) == 0) { + struct addrinfo hack_ai; + memset(&hack_ai, 0, sizeof(hack_ai)); + hack_ai.ai_addr = (struct sockaddr *) &ss; + hack_ai.ai_addrlen = sslen; + hack_ai.ai_socktype = SOCK_DGRAM; + hack_ai.ai_family = ai->ai_family; + dprint("local socket address is %A\n", &hack_ai); + } + } +#endif FD_SET(state->fd, &selstate->rfds); if (state->state == CONNECTING || state->state == WRITING) FD_SET(state->fd, &selstate->wfds);