res_send: Avoid spurious close()s and (rare) failure
When looping over the current list of sockets we are connected to, use getpeername() not getsockname() to find out who the remote end is. This change avoids spurious close() and (rare) failure. Origin: ISC bug #18625 and fixed in libbind 6.0 Change-Id: I5e85f9ff4b98c237978e4bf4bd85ba0a90d768e6
This commit is contained in:
parent
e30e909363
commit
87043f9c89
1 changed files with 1 additions and 1 deletions
|
@ -413,7 +413,7 @@ res_nsend(res_state statp,
|
|||
if (EXT(statp).nssocks[ns] == -1)
|
||||
continue;
|
||||
peerlen = sizeof(peer);
|
||||
if (getsockname(EXT(statp).nssocks[ns],
|
||||
if (getpeername(EXT(statp).nssocks[ns],
|
||||
(struct sockaddr *)(void *)&peer, &peerlen) < 0) {
|
||||
needclose++;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue