remove check for casting size to u32
This commit is contained in:
parent
3266a7fccf
commit
d942d615d5
|
@ -159,12 +159,14 @@ pub use libc::sockaddr_vm;
|
||||||
|
|
||||||
// This function is unsafe since we have to pass it a C-style union.
|
// This function is unsafe since we have to pass it a C-style union.
|
||||||
pub unsafe fn connect(fd: RawFd, sockaddr: *mut libc::sockaddr, size: usize) -> Result<()> {
|
pub unsafe fn connect(fd: RawFd, sockaddr: *mut libc::sockaddr, size: usize) -> Result<()> {
|
||||||
|
/*
|
||||||
let size = u32::try_from(size).context(format_args!(
|
let size = u32::try_from(size).context(format_args!(
|
||||||
"connect(..., size = {size}) has size > {}",
|
"connect(..., size = {size}) has size > {}",
|
||||||
u32::MAX
|
u32::MAX
|
||||||
))?;
|
))?;
|
||||||
|
*/
|
||||||
|
|
||||||
match unsafe { libc::connect(fd, sockaddr, size) } {
|
match unsafe { libc::connect(fd, sockaddr, size as u32) } {
|
||||||
0 => Ok(()),
|
0 => Ok(()),
|
||||||
-1 => ctx_os_error(format_args!("error calling connect({fd}, ...)")),
|
-1 => ctx_os_error(format_args!("error calling connect({fd}, ...)")),
|
||||||
n => unreachable!("connect({fd}, ...) returned bad value: {n}"),
|
n => unreachable!("connect({fd}, ...) returned bad value: {n}"),
|
||||||
|
|
Loading…
Reference in New Issue