Skip to content

Commit b87d45b

Browse files
bors[bot]Bryant Mairs
and
Bryant Mairs
committed
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>
2 parents d52227f + a5b01af commit b87d45b

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/sys/socket/mod.rs

-16
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ pub fn listen(sockfd: RawFd, backlog: usize) -> Result<()> {
788788
/// Bind a name to a socket
789789
///
790790
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html)
791-
#[cfg(not(all(target_os="android", target_pointer_width="64")))]
792791
pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> {
793792
let res = unsafe {
794793
let (ptr, len) = addr.as_ffi_pair();
@@ -798,21 +797,6 @@ pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> {
798797
Errno::result(res).map(drop)
799798
}
800799

801-
/// Bind a name to a socket
802-
///
803-
/// [Further reading](http://man7.org/linux/man-pages/man2/bind.2.html)
804-
// Android has some weirdness. Its 64-bit bind takes a c_int instead of a
805-
// socklen_t
806-
#[cfg(all(target_os="android", target_pointer_width="64"))]
807-
pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> {
808-
let res = unsafe {
809-
let (ptr, len) = addr.as_ffi_pair();
810-
libc::bind(fd, ptr, len as c_int)
811-
};
812-
813-
Errno::result(res).map(drop)
814-
}
815-
816800
/// Accept a connection on a socket
817801
///
818802
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html)

0 commit comments

Comments
 (0)