cap-primitives 0.9.0

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

/// *Unsandboxed* function similar to `hard_link`, but which does not perform sandboxing.
///
/// Even though POSIX `linkat` has the ability to follow symlinks in `old_path`,
/// using `AT_SYMLINK_FOLLOW`, Rust's `hard_link` doesn't need that, so we don't
/// expose it here.
pub(crate) fn hard_link_unchecked(
    old_start: &fs::File,
    old_path: &Path,
    new_start: &fs::File,
    new_path: &Path,
) -> io::Result<()> {
    linkat(old_start, old_path, new_start, new_path, AtFlags::empty())
}