MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / open_dir_no_follow

Function open_dir_no_follow

atomic-repository/src/repository/observability.rs:1073–1088  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

1071/// O_DIRECTORY cannot slip a special file through.
1072#[cfg(unix)]
1073fn open_dir_no_follow(path: &Path) -> Result<(), std::io::Error> {
1074 let file = std::fs::OpenOptions::new()
1075 .read(true)
1076 .custom_flags(OPEN_NO_FOLLOW | OPEN_DIRECTORY)
1077 .open(path)?;
1078 if !file.metadata()?.is_dir() {
1079 return Err(std::io::Error::new(
1080 std::io::ErrorKind::Unsupported,
1081 format!(
1082 "event journal ancestor '{}' is not a directory",
1083 path.display()
1084 ),
1085 ));
1086 }
1087 Ok(())
1088}
1089
1090#[cfg(not(unix))]
1091fn open_dir_no_follow(path: &Path) -> Result<(), std::io::Error> {

Callers 1

Calls 4

is_dirMethod · 0.80
openMethod · 0.45
readMethod · 0.45
metadataMethod · 0.45

Tested by

no test coverage detected