Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/uu/mkfifo/src/mkfifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// file that was distributed with this source code.

use clap::{Arg, ArgAction, Command, value_parser};
use rustix::fs::Mode;
use rustix::fs::{Mode, RawMode};
use rustix::process::umask;
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, strip_errno};
Expand Down Expand Up @@ -69,7 +69,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// attacker could use to swap the FIFO for a symlink between
// mkfifo and chmod (issue #10020).
let prev_umask = umask(Mode::empty());
let mkfifo_result = create_fifo(f.as_str(), mode);
let mkfifo_result = create_fifo(f.as_str(), mode as RawMode);
umask(prev_umask);

if let Err(e) = mkfifo_result {
Expand Down Expand Up @@ -141,13 +141,13 @@ pub fn uu_app() -> Command {
// libc's path-based `mkfifo` there. Both rely on the caller having cleared
// the umask so the requested mode is applied atomically (see issue #10020).
#[cfg(not(target_vendor = "apple"))]
fn create_fifo(path: &str, mode: u32) -> Result<(), std::io::Error> {
use rustix::fs::{CWD, mkfifoat};
mkfifoat(CWD, path, Mode::from_bits_truncate(mode)).map_err(std::io::Error::from)
fn create_fifo(path: &str, mode: RawMode) -> Result<(), std::io::Error> {
use rustix::fs;
Ok(fs::mkfifoat(fs::CWD, path, Mode::from_bits_truncate(mode))?)
}

#[cfg(target_vendor = "apple")]
fn create_fifo(path: &str, mode: u32) -> Result<(), std::io::Error> {
fn create_fifo(path: &str, mode: RawMode) -> Result<(), std::io::Error> {
use std::ffi::CString;
let c_path =
CString::new(path).map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e))?;
Expand Down
Loading