1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-04 06:57:47 +00:00

Fix cp build on Redox

This commit is contained in:
Ian Douglas Scott 2017-11-13 22:51:55 -08:00
parent a23a8ed1f1
commit 75141f0382
No known key found for this signature in database
GPG key ID: 4924E10E199B5959

View file

@ -674,6 +674,9 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<S
} }
fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::PathBuf, dest: std::path::PathBuf, found_hard_link: &mut bool) -> CopyResult<()> { fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::PathBuf, dest: std::path::PathBuf, found_hard_link: &mut bool) -> CopyResult<()> {
// Redox does not currently support hard links
#[cfg(not(target_os = "redox"))]
{
if !source.is_dir() { if !source.is_dir() {
unsafe { unsafe {
let src_path = CString::new(source.as_os_str().to_str().unwrap()).unwrap(); let src_path = CString::new(source.as_os_str().to_str().unwrap()).unwrap();
@ -714,6 +717,7 @@ fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::P
} }
} }
} }
}
Ok(()) Ok(())
} }
@ -826,7 +830,8 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult
} }
} }
#[cfg(windows)] // This should be changed once Redox supports hardlinks
#[cfg(any(windows, target_os = "redox"))]
let mut hard_links: Vec<(String, u64)> = vec![]; let mut hard_links: Vec<(String, u64)> = vec![];
for path in WalkDir::new(root) { for path in WalkDir::new(root) {