Skip to content

Commit 3aff803

Browse files
committed
Add comment
1 parent 085874d commit 3aff803

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/shims/fs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
140140
this.handle_not_found()
141141
}
142142
} else if cmd == this.eval_libc_i32("F_DUPFD")? || cmd == this.eval_libc_i32("F_DUPFD_CLOEXEC")? {
143+
// Note that we always assume the FD_CLOEXEC flag is set for every open file, in part
144+
// because exec() isn't supported. The F_DUPFD and F_DUPFD_CLOEXEC commands only
145+
// differ in whether the FD_CLOEXEC flag is pre-set on the duplicated file descriptor,
146+
// thus they can share the same implementation here.
143147
let arg = match arg_op {
144148
Some(arg_op) => this.read_scalar(arg_op)?.to_i32()?,
145149
None => throw_unsup_format!("fcntl with command F_DUPFD or F_DUPFD_CLOEXEC requires a third argument"),

0 commit comments

Comments
 (0)