Skip to content

Commit d8da396

Browse files
committed
Change function name, comments, and error message
1 parent 90f3aae commit d8da396

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/shims/fs.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
347347
Some(metadata) => metadata,
348348
None => return Ok(-1),
349349
};
350-
stat_write_buf(this, metadata, buf_op)
350+
stat_macos_write_buf(this, metadata, buf_op)
351351
}
352352

353353
fn stat_or_lstat(
@@ -369,7 +369,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
369369
Some(metadata) => metadata,
370370
None => return Ok(-1),
371371
};
372-
stat_write_buf(this, metadata, buf_op)
372+
stat_macos_write_buf(this, metadata, buf_op)
373373
}
374374

375375
fn statx(
@@ -427,17 +427,23 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
427427
this.read_scalar(dirfd_op)?.to_machine_isize(&*this.tcx)?.try_into().map_err(|e| {
428428
err_unsup_format!("Failed to convert pointer sized operand to integer: {}", e)
429429
})?;
430-
// we only support interpreting `path` as an absolute directory or as a directory relative
431-
// to `dirfd` when the latter is `AT_FDCWD`. The behavior of `statx` with a relative path
432-
// and a directory file descriptor other than `AT_FDCWD` is specified but it cannot be
433-
// tested from `libstd`. If you found this error, please open an issue reporting it.
430+
// We only support:
431+
// * interpreting `path` as an absolute directory,
432+
// * interpreting `path` as a path relative to `dirfd` when the latter is `AT_FDCWD`, or
433+
// * interpreting `dirfd` as any file descriptor when `path` is empty and AT_EMPTY_PATH is
434+
// set.
435+
// The behavior of `statx` with a relative path and a directory file descriptor other than
436+
// `AT_FDCWD` is specified but it cannot be tested from `libstd`. If you found this error,
437+
// please open an issue reporting it.
434438
if !(
435439
path.is_absolute() ||
436440
dirfd == this.eval_libc_i32("AT_FDCWD")? ||
437441
(path.as_os_str().is_empty() && empty_path_flag)
438442
) {
439443
throw_unsup_format!(
440-
"Using statx with a relative path and a file descriptor different from `AT_FDCWD` is not supported"
444+
"Using statx is only supported with absolute paths, relative paths with the file \
445+
descriptor `AT_FDCWD`, and empty paths with the `AT_EMPTY_PATH` flag set and any \
446+
file descriptor"
441447
)
442448
}
443449

@@ -631,7 +637,7 @@ impl FileMetadata {
631637
}
632638
}
633639

634-
fn stat_write_buf<'tcx, 'mir>(
640+
fn stat_macos_write_buf<'tcx, 'mir>(
635641
ecx: &mut MiriEvalContext<'mir, 'tcx>,
636642
metadata: FileMetadata,
637643
buf_op: OpTy<'tcx, Tag>,

0 commit comments

Comments
 (0)