mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
paste: remove unsafe from test code
This commit is contained in:
@@ -451,19 +451,11 @@ fn test_paste_non_utf8_paths() {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn make_broken_pipe() -> std::fs::File {
|
||||
use std::os::unix::io::FromRawFd;
|
||||
|
||||
let mut fds: [libc::c_int; 2] = [0, 0];
|
||||
assert_eq!(
|
||||
unsafe { libc::pipe(fds.as_mut_ptr()) },
|
||||
0,
|
||||
"Failed to create pipe"
|
||||
);
|
||||
|
||||
let (read, write) = rustix::pipe::pipe().expect("Failed to create pipe");
|
||||
// Drop the read end so writes fail with EPIPE.
|
||||
let _ = unsafe { std::fs::File::from_raw_fd(fds[0]) };
|
||||
drop(read);
|
||||
|
||||
unsafe { std::fs::File::from_raw_fd(fds[1]) }
|
||||
write.into()
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user