From 5ce372082077bad27f2857979e1a09427f97d921 Mon Sep 17 00:00:00 2001 From: tommady Date: Wed, 4 Oct 2023 09:12:26 +0000 Subject: [PATCH] fix freebds mode_t is u16 but other unix platforms are u32 --- src/uu/cp/src/cp.rs | 20 ++++++++++++++++---- tests/by-util/test_cp.rs | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 1a9d5059d..f8c5ef3ce 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1752,20 +1752,32 @@ fn copy_file( #[cfg(not(any( target_os = "android", target_os = "macos", - target_os = "macos-12" + target_os = "macos-12", + target_os = "freebds", )))] const MODE_RW_UGO: u32 = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; #[cfg(not(any( target_os = "android", target_os = "macos", - target_os = "macos-12" + target_os = "macos-12", + target_os = "freebds", )))] const S_IRWXUGO: u32 = S_IRWXU | S_IRWXG | S_IRWXO; - #[cfg(any(target_os = "android", target_os = "macos", target_os = "macos-12"))] + #[cfg(any( + target_os = "android", + target_os = "macos", + target_os = "macos-12", + target_os = "freebds", + ))] const MODE_RW_UGO: u32 = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) as u32; - #[cfg(any(target_os = "android", target_os = "macos", target_os = "macos-12"))] + #[cfg(any( + target_os = "android", + target_os = "macos", + target_os = "macos-12", + target_os = "freebds", + ))] const S_IRWXUGO: u32 = (S_IRWXU | S_IRWXG | S_IRWXO) as u32; match is_explicit_no_preserve_mode { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index e85cd0c57..96b47cd43 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1553,7 +1553,7 @@ fn test_cp_preserve_links_case_7() { } #[test] -#[cfg(all(unix, not(target_os = "freebsd")))] +#[cfg(all(unix))] fn test_cp_no_preserve_mode_case() { use libc::umask; use uucore::fs as uufs;