diff options
| author | Ralf Jung <post@ralfj.de> | 2023-11-25 10:29:22 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-11-25 10:33:30 +0100 |
| commit | ce94b22cd6130a560155f02b8634f117f7fd36c6 (patch) | |
| tree | 9e1f37674154e96c7e113d41b96414d1079dacfe | |
| parent | 69ea9520d3b7dee9df59128acec43f9b15aa3ee2 (diff) | |
| download | rust-ce94b22cd6130a560155f02b8634f117f7fd36c6.tar.gz rust-ce94b22cd6130a560155f02b8634f117f7fd36c6.zip | |
read off_t at the right size for the current target
| -rw-r--r-- | src/tools/miri/src/shims/unix/foreign_items.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/unix/fs.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/miri/src/shims/unix/foreign_items.rs b/src/tools/miri/src/shims/unix/foreign_items.rs index c1c3e3fa10c..23342c8045e 100644 --- a/src/tools/miri/src/shims/unix/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/foreign_items.rs @@ -163,14 +163,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let fd = this.read_scalar(fd)?.to_i32()?; let length = this.read_scalar(length)?.to_i64()?; - let result = this.ftruncate64(fd, length)?; + let result = this.ftruncate64(fd, length.into())?; this.write_scalar(result, dest)?; } "ftruncate" => { let [fd, length] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; let fd = this.read_scalar(fd)?.to_i32()?; - let length = this.read_target_isize(length)?; + let length = this.read_scalar(length)?.to_int(this.libc_ty_layout("off_t").size)?; let result = this.ftruncate64(fd, length)?; this.write_scalar(result, dest)?; } diff --git a/src/tools/miri/src/shims/unix/fs.rs b/src/tools/miri/src/shims/unix/fs.rs index d545cb46069..ba40a1b3c32 100644 --- a/src/tools/miri/src/shims/unix/fs.rs +++ b/src/tools/miri/src/shims/unix/fs.rs @@ -1504,7 +1504,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } } - fn ftruncate64(&mut self, fd: i32, length: i64) -> InterpResult<'tcx, Scalar<Provenance>> { + fn ftruncate64(&mut self, fd: i32, length: i128) -> InterpResult<'tcx, Scalar<Provenance>> { let this = self.eval_context_mut(); // Reject if isolation is enabled. |
