cap-primitives 0.16.1

Capability-based primitives
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use posish::fs::readlinkat;
use std::{
    fs, io,
    path::{Path, PathBuf},
};

/// *Unsandboxed* function similar to `read_link`, but which does not perform
/// sandboxing.
pub(crate) fn read_link_unchecked(
    start: &fs::File,
    path: &Path,
    reuse: PathBuf,
) -> io::Result<PathBuf> {
    Ok(readlinkat(start, path, reuse.into()).map(Into::into)?)
}