diff --git a/src/shims/fs.rs b/src/shims/fs.rs index 07390be2c8bb..b766dd6de47a 100644 --- a/src/shims/fs.rs +++ b/src/shims/fs.rs @@ -140,6 +140,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.handle_not_found() } } else if cmd == this.eval_libc_i32("F_DUPFD")? || cmd == this.eval_libc_i32("F_DUPFD_CLOEXEC")? { + // Note that we always assume the FD_CLOEXEC flag is set for every open file, in part + // because exec() isn't supported. The F_DUPFD and F_DUPFD_CLOEXEC commands only + // differ in whether the FD_CLOEXEC flag is pre-set on the duplicated file descriptor, + // thus they can share the same implementation here. let arg = match arg_op { Some(arg_op) => this.read_scalar(arg_op)?.to_i32()?, None => throw_unsup_format!("fcntl with command F_DUPFD or F_DUPFD_CLOEXEC requires a third argument"),