diff options
author | Jim Huang <jserv@0xlab.org> | 2011-12-12 16:32:56 +0800 |
---|---|---|
committer | Jim Huang <jserv@0xlab.org> | 2012-01-14 11:30:00 +0800 |
commit | 87043f9c89593125a27199d0c1b4069d088672d7 (patch) | |
tree | 161f017fed7022c8a8f898fd880ab3306577a9e2 /libc | |
parent | e30e909363c5c706f394050d9cd00ce222caadbf (diff) | |
download | android_bionic-87043f9c89593125a27199d0c1b4069d088672d7.tar.gz android_bionic-87043f9c89593125a27199d0c1b4069d088672d7.tar.bz2 android_bionic-87043f9c89593125a27199d0c1b4069d088672d7.zip |
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
Diffstat (limited to 'libc')
-rw-r--r-- | libc/netbsd/resolv/res_send.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/netbsd/resolv/res_send.c b/libc/netbsd/resolv/res_send.c index b11895621..1a28d9e7b 100644 --- a/libc/netbsd/resolv/res_send.c +++ b/libc/netbsd/resolv/res_send.c @@ -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; |