Skip to main content

ensure_state_dir

Function ensure_state_dir 

Source
pub fn ensure_state_dir(dir: impl AsRef<Path>) -> Result<OwnedFd, CoreError>
Expand description

Create dir if needed, then verify it is a real directory with no symlink component and that it is owned by the current effective uid. Returning the anchored fd lets callers refuse to operate inside an attacker-pre-created or attacker-redirected state directory.