From 15cb0242ea58ae0c102fc84c3044b4c2f5fc532c Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 11 Mar 2024 16:24:39 +0100 Subject: [PATCH] uucore/pipes: adapt to new return type of nix fn nix 0.28 changed the return type of unistd::pipe() from Result<(RawFd, RawFd), Error> to Result<(OwnedFd, OwnedFd), Error> --- src/uucore/src/lib/features/pipes.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uucore/src/lib/features/pipes.rs b/src/uucore/src/lib/features/pipes.rs index 75749f721..17c5b1b32 100644 --- a/src/uucore/src/lib/features/pipes.rs +++ b/src/uucore/src/lib/features/pipes.rs @@ -8,7 +8,6 @@ use std::fs::File; use std::io::IoSlice; #[cfg(any(target_os = "linux", target_os = "android"))] use std::os::unix::io::AsRawFd; -use std::os::unix::io::FromRawFd; #[cfg(any(target_os = "linux", target_os = "android"))] use nix::fcntl::SpliceFFlags; @@ -21,8 +20,7 @@ pub use nix::{Error, Result}; /// from the first. pub fn pipe() -> Result<(File, File)> { let (read, write) = nix::unistd::pipe()?; - // SAFETY: The file descriptors do not have other owners. - unsafe { Ok((File::from_raw_fd(read), File::from_raw_fd(write))) } + Ok((File::from(read), File::from(write))) } /// Less noisy wrapper around [`nix::fcntl::splice`].