Skip to content

Commit

Permalink
check O_TMPFILE flag on linux only
Browse files Browse the repository at this point in the history
  • Loading branch information
Pointerbender committed Dec 8, 2022
1 parent 3005fb3 commit f01d2bf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
// (Technically we do not support *not* setting this flag, but we ignore that.)
mirror |= o_cloexec;
}
let o_tmpfile = this.eval_libc_i32("O_TMPFILE")?;
if flag & o_tmpfile != 0 {
// if the flag contains `O_TMPFILE` then we return a graceful error
let eopnotsupp = this.eval_libc("EOPNOTSUPP")?;
this.set_last_error(eopnotsupp)?;
return Ok(-1);
if cfg!(target_os = "linux") {
let o_tmpfile = this.eval_libc_i32("O_TMPFILE")?;
if flag & o_tmpfile != 0 {
// if the flag contains `O_TMPFILE` then we return a graceful error
let eopnotsupp = this.eval_libc("EOPNOTSUPP")?;
this.set_last_error(eopnotsupp)?;
return Ok(-1);
}
}
// If `flag` is not equal to `mirror`, there is an unsupported option enabled in `flag`,
// then we throw an error.
Expand Down

0 comments on commit f01d2bf

Please sign in to comment.