Skip to content

Commit f2ebd0a

Browse files
committed
Remove assertion on output length for getsockopt.
POSIX allows `getsockopt` to set `*option_len` to a smaller value if necessary. Windows will set `*option_len` to 1 for boolean options even when the caller passes a `BOOL` (`int`) with `*option_len` as 4.
1 parent 3eb983e commit f2ebd0a

File tree

1 file changed

+0
-1
lines changed
  • library/std/src/sys_common

1 file changed

+0
-1
lines changed

library/std/src/sys_common/net.rs

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ pub fn getsockopt<T: Copy>(sock: &Socket, level: c_int, option_name: c_int) -> i
8787
&mut option_value as *mut T as *mut _,
8888
&mut option_len,
8989
))?;
90-
assert_eq!(option_len as usize, mem::size_of::<T>());
9190
Ok(option_value)
9291
}
9392
}

0 commit comments

Comments
 (0)