this.write_scalar(Scalar::from_i32(result), dest)?;
}
"setenv" => {
- let &[name, value, _overwrite] = check_arg_count(args)?;
+ let &[name, value, overwrite] = check_arg_count(args)?;
+ this.read_scalar(overwrite)?.to_i32()?;
let result = this.setenv(name, value)?;
this.write_scalar(Scalar::from_i32(result), dest)?;
}
// File related shims
"open" | "open64" => {
- let &[path, flag, _mode] = check_arg_count(args)?;
- let result = this.open(path, flag)?;
+ let &[path, flag, mode] = check_arg_count(args)?;
+ let result = this.open(path, flag, mode)?;
this.write_scalar(Scalar::from_i32(result), dest)?;
}
"fcntl" => {
this.write_scalar(Scalar::from_machine_isize(which.into(), this), dest)?;
}
"WriteFile" => {
- let &[handle, buf, n, written_ptr, _overlapped] = check_arg_count(args)?;
+ let &[handle, buf, n, written_ptr, overlapped] = check_arg_count(args)?;
+ this.read_scalar(overlapped)?.to_machine_usize(this)?; // this is a poiner, that we ignore
let handle = this.read_scalar(handle)?.to_machine_isize(this)?;
let buf = this.read_scalar(buf)?.not_undef()?;
let n = this.read_scalar(n)?.to_u32()?;
&mut self,
path_op: OpTy<'tcx, Tag>,
flag_op: OpTy<'tcx, Tag>,
+ mode_op: OpTy<'tcx, Tag>,
) -> InterpResult<'tcx, i32> {
let this = self.eval_context_mut();
let flag = this.read_scalar(flag_op)?.to_i32()?;
+ // Check mode (size depends on platform).
+ // FIXME: should we do something with the mode?
+ match this.tcx.sess.target.target.target_os.as_str() {
+ "macos" => {
+ // FIXME: I think `mode` should be `u16` on macOS, but see
+ // <https://github.com/rust-lang/rust/issues/71915>.
+ // For now, just don't check on macos.
+ }
+ _ => {
+ this.read_scalar(mode_op)?.to_u32()?;
+ }
+ };
+
let mut options = OpenOptions::new();
let o_rdonly = this.eval_libc_i32("O_RDONLY")?;