diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index c252bb3a36b..b7b42cee7d2 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -28,6 +28,7 @@ rustc-hash = { workspace = true } thiserror = { workspace = true } uucore = { workspace = true, features = [ "backup-control", + "buf-copy", "fs", "fsxattr", "perms", diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 0e6cbaa3657..719a7409ad9 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -1310,7 +1310,8 @@ fn rename_file_fallback( & 0o7777; let mut dst_file = create_dest_restrictive(to, /* nofollow */ true) .map_err(|err| io::Error::new(err.kind(), translate!("mv-error-permission-denied")))?; - io::copy(&mut &src_file, &mut dst_file) + // copy_stream has fast-path for Linux + uucore::buf_copy::copy_stream(&mut &src_file, &mut dst_file) .map_err(|err| io::Error::new(err.kind(), translate!("mv-error-permission-denied")))?; #[cfg(not(any(target_os = "macos", target_os = "redox")))]