Rollup merge of #122983 - taiki-e:bsd, r=workingjubilee

Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD

Fixes https://github.com/rust-lang/rust/pull/121881#discussion_r1536764650

Checked targets: aarch64-unknown-freebsd, powerpc64-unknown-freebsd, armv7-unknown-freebsd, riscv64gc-unknown-freebsd, aarch64-unknown-netbsd.

r? ``@Amanieu``
cc ``@devnexen``
This commit is contained in:
Matthias Krüger 2024-03-24 17:08:18 +01:00 committed by GitHub
commit a5852ef941
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -459,7 +459,7 @@ pub fn set_acceptfilter(&self, name: &CStr) -> io::Result<()> {
const AF_NAME_MAX: usize = 16; const AF_NAME_MAX: usize = 16;
let mut buf = [0; AF_NAME_MAX]; let mut buf = [0; AF_NAME_MAX];
for (src, dst) in name.to_bytes().iter().zip(&mut buf[..AF_NAME_MAX - 1]) { for (src, dst) in name.to_bytes().iter().zip(&mut buf[..AF_NAME_MAX - 1]) {
*dst = *src as i8; *dst = *src as libc::c_char;
} }
let mut arg: libc::accept_filter_arg = unsafe { mem::zeroed() }; let mut arg: libc::accept_filter_arg = unsafe { mem::zeroed() };
arg.af_name = buf; arg.af_name = buf;