diff --git a/src/shims/unix/fs.rs b/src/shims/unix/fs.rs index dbd9ef1042..5682fb659e 100644 --- a/src/shims/unix/fs.rs +++ b/src/shims/unix/fs.rs @@ -1048,7 +1048,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } } - fn linux_solarish_readdir64(&mut self, dirp_op: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar> { + fn linux_solarish_readdir64( + &mut self, + dirent_type: &str, + dirp_op: &OpTy<'tcx>, + ) -> InterpResult<'tcx, Scalar> { let this = self.eval_context_mut(); if !matches!(&*this.tcx.sess.target.os, "linux" | "solaris" | "illumos") { @@ -1097,7 +1101,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let name_bytes = name.as_encoded_bytes(); let name_len = u64::try_from(name_bytes.len()).unwrap(); - let dirent_layout = this.libc_ty_layout("dirent"); + let dirent_layout = this.libc_ty_layout(dirent_type); let fields = &dirent_layout.fields; let last_field = fields.count().strict_sub(1); let d_name_offset = fields.offset(last_field).bytes(); diff --git a/src/shims/unix/linux/foreign_items.rs b/src/shims/unix/linux/foreign_items.rs index 6697fa49e4..6d0a2143fe 100644 --- a/src/shims/unix/linux/foreign_items.rs +++ b/src/shims/unix/linux/foreign_items.rs @@ -37,7 +37,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "readdir64" => { let [dirp] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?; - let result = this.linux_solarish_readdir64(dirp)?; + let result = this.linux_solarish_readdir64("dirent64", dirp)?; this.write_scalar(result, dest)?; } "sync_file_range" => { diff --git a/src/shims/unix/solarish/foreign_items.rs b/src/shims/unix/solarish/foreign_items.rs index cf0b432667..faf280ad88 100644 --- a/src/shims/unix/solarish/foreign_items.rs +++ b/src/shims/unix/solarish/foreign_items.rs @@ -79,7 +79,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "readdir" => { let [dirp] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?; - let result = this.linux_solarish_readdir64(dirp)?; + let result = this.linux_solarish_readdir64("dirent", dirp)?; this.write_scalar(result, dest)?; }