Files
wayscriber/src/test_temp.rs
T
devmobasa f108e45964 refactor: use rustix for anchored file operations
Move the no-replace renames, the pinned runtime state paths, and the
input node access check to rustix, removing their unsafe blocks. The
paths keep their existing NUL checks and error messages.

Share one safe FIFO helper across the tests that repeated an unsafe
mkfifo block, since the std version is still unstable.
2026-10-30 20:04:02 +01:00

20 lines
475 B
Rust

#[cfg(unix)]
use std::path::Path;
#[cfg(unix)]
use rustix::fs::{self as rustix_fs, FileType, Mode};
pub(crate) use tempfile::{TempDir, tempdir};
/// Creates a FIFO that only the current user can open.
#[cfg(unix)]
pub(crate) fn make_fifo(path: &Path) {
rustix_fs::mknodat(
rustix_fs::CWD,
path,
FileType::Fifo,
Mode::RUSR | Mode::WUSR,
0,
)
.unwrap_or_else(|errno| panic!("mkfifo {} failed: {errno}", path.display()));
}