fix error returned from readdir_r when isolation is enabled

This commit is contained in:
Ralf Jung 2024-10-26 08:58:48 +02:00
parent 3432b91bbc
commit 72664f7760

View File

@ -1130,8 +1130,8 @@ fn macos_fbsd_readdir_r(
// 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(|| {