mirror of
https://github.com/devmobasa/wayscriber.git
synced 2026-11-01 07:36:42 +01:00
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.
20 lines
475 B
Rust
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()));
|
|
}
|