Skip to content

Commit

Permalink
fix error returned from readdir_r when isolation is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 26, 2024
1 parent 3432b91 commit 72664f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tools/miri/src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,8 +1130,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("`readdir_r`", reject_with)?;
// Set error code as "EBADF" (bad fd)
return this.set_last_error_and_return_i32(LibcError("EBADF"));
// Return error code, do *not* set `errno`.
return interp_ok(this.eval_libc("EBADF"));
}

let open_dir = this.machine.dirs.streams.get_mut(&dirp).ok_or_else(|| {
Expand Down

0 comments on commit 72664f7

Please sign in to comment.