diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-05-29 02:54:18 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-05-29 02:54:18 +0000 |
commit | b87d45b349485cf2ecf7414af70133bd8e91c4ab (patch) | |
tree | e08f69a9d85e6d49b2769b469210e3ae26288b91 | |
parent | d52227f436b86984b354eee7d57d9a78abad2369 (diff) | |
parent | a5b01afecbf6a9e2844ec55d63d34df846797aae (diff) | |
download | nix-b87d45b349485cf2ecf7414af70133bd8e91c4ab.zip |
Merge #906
906: Fix bind() on Android 64-bit r=Susurrus a=Susurrus
libc fixed `bind()` for Android 64-bit targets, so change our
code to match.
PRs are failing (like #901) so let's get this merged.
CC @asomers @morrowa
Co-authored-by: Bryant Mairs <bryantmairs@google.com>
-rw-r--r-- | src/sys/socket/mod.rs | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index af66bc47..fcb79af9 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -788,7 +788,6 @@ pub fn listen(sockfd: RawFd, backlog: usize) -> Result<()> { /// Bind a name to a socket /// /// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html) -#[cfg(not(all(target_os="android", target_pointer_width="64")))] pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> { let res = unsafe { let (ptr, len) = addr.as_ffi_pair(); @@ -798,21 +797,6 @@ pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> { Errno::result(res).map(drop) } -/// Bind a name to a socket -/// -/// [Further reading](http://man7.org/linux/man-pages/man2/bind.2.html) -// Android has some weirdness. Its 64-bit bind takes a c_int instead of a -// socklen_t -#[cfg(all(target_os="android", target_pointer_width="64"))] -pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> { - let res = unsafe { - let (ptr, len) = addr.as_ffi_pair(); - libc::bind(fd, ptr, len as c_int) - }; - - Errno::result(res).map(drop) -} - /// Accept a connection on a socket /// /// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html) |