@@ -411,9 +411,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
411411
412412 // If the `AT_SYMLINK_NOFOLLOW` flag is set, we query the file's metadata without following
413413 // symbolic links.
414- let is_symlink = flags & this. eval_libc ( "AT_SYMLINK_NOFOLLOW" ) ?. to_i32 ( ) ? ! = 0 ;
414+ let follow_symlink = flags & this. eval_libc ( "AT_SYMLINK_NOFOLLOW" ) ?. to_i32 ( ) ? = = 0 ;
415415
416- let status = match FileStatus :: new ( this, path, is_symlink ) ? {
416+ let status = match FileStatus :: new ( this, path, follow_symlink ) ? {
417417 Some ( status) => status,
418418 None => return Ok ( -1 ) ,
419419 } ;
@@ -428,6 +428,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
428428 . try_into ( )
429429 . unwrap_or_else ( |_| bug ! ( "libc contains bad value for constant" ) ) ;
430430
431+ // We need to set the corresponding bits of `mask` if the access, creation and modification
432+ // times were available. Otherwise we let them be zero.
431433 let ( access_sec, access_nsec) = status. accessed . map ( |tup| {
432434 mask |= this. eval_libc ( "STATX_ATIME" ) ?. to_u32 ( ) ?;
433435 InterpResult :: Ok ( tup)
@@ -497,9 +499,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
497499 }
498500}
499501
500- // Extracts the number of seconds and nanoseconds elapsed between `time` and the unix epoch when
501- // `time` is Ok. If `time` is an error, it returns `None`.
502- fn extract_sec_and_nsec < ' tcx > ( time : std:: io:: Result < SystemTime > ) -> InterpResult < ' tcx , Option < ( u64 , u32 ) > > {
502+ /// Extracts the number of seconds and nanoseconds elapsed between `time` and the unix epoch when
503+ /// `time` is Ok. Returns `None` if `time` is an error. Fails if `time` happens before the unix
504+ /// epoch.
505+ fn extract_sec_and_nsec < ' tcx > (
506+ time : std:: io:: Result < SystemTime >
507+ ) -> InterpResult < ' tcx , Option < ( u64 , u32 ) > > {
503508 time. ok ( ) . map ( |time| {
504509 let duration = system_time_to_duration ( & time) ?;
505510 Ok ( ( duration. as_secs ( ) , duration. subsec_nanos ( ) ) )
@@ -518,9 +523,9 @@ impl FileStatus {
518523 fn new < ' tcx , ' mir > (
519524 ecx : & mut MiriEvalContext < ' mir , ' tcx > ,
520525 path : PathBuf ,
521- is_symlink : bool
526+ follow_symlink : bool
522527 ) -> InterpResult < ' tcx , Option < FileStatus > > {
523- let metadata = if is_symlink {
528+ let metadata = if follow_symlink {
524529 // FIXME: metadata for symlinks need testing.
525530 std:: fs:: symlink_metadata ( path)
526531 } else {
0 commit comments