Skip to content

Commit

Permalink
fix stray compiler errors after rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
noahmbright committed Oct 19, 2024
1 parent 337fdf9 commit 4c002e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/shims/io_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
interp_ok(Scalar::from_i32(-1))
}

/// Sets the last OS error and return `-1` as a `i32`-typed Scalar
/// Sets the last OS error and return `-1` as a `i64`-typed Scalar
fn set_last_error_and_return_i64(
&mut self,
err: impl Into<IoError>,
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
fn fd_not_found<T: From<i32>>(&mut self) -> InterpResult<'tcx, T> {
let this = self.eval_context_mut();
this.set_last_error(LibcError("EBADF"))?;
Ok((-1).into())
interp_ok((-1).into())
}

/// Read data from `fd` into buffer specified by `buf` and `count`.
Expand Down
8 changes: 6 additions & 2 deletions src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// Reject if isolation is enabled.
if let IsolatedOp::Reject(reject_with) = this.machine.isolated_op {
this.reject_in_isolation("`readlink`", reject_with)?;
return this.set_last_error_and_return_i64(LibcError("EACCES"));
this.set_last_error(LibcError("EACCES"))?;
return interp_ok(-1);
}

let result = std::fs::read_link(pathname);
Expand All @@ -1432,7 +1433,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
this.write_bytes_ptr(buf, path_bytes.iter().copied())?;
interp_ok(path_bytes.len().try_into().unwrap())
}
Err(e) => this.set_last_error_and_return_i64(e),
Err(e) => {
this.set_last_error(e)?;
interp_ok(-1)
}
}
}

Expand Down

0 comments on commit 4c002e3

Please sign in to comment.