Skip to content

Commit 00ec3cf

Browse files
committed
Use copy_file_range on android also
1 parent b4b71d5 commit 00ec3cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libstd/sys/unix/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
761761
Ok(PathBuf::from(OsString::from_vec(buf)))
762762
}
763763

764-
#[cfg(not(target_os = "linux"))]
764+
#[cfg(not(any(target_os = "linux", target_os = "android")))]
765765
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
766766
use fs::{File, set_permissions};
767767
if !from.is_file() {
@@ -778,7 +778,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
778778
Ok(ret)
779779
}
780780

781-
#[cfg(target_os = "linux")]
781+
#[cfg(any(target_os = "linux", target_os = "android"))]
782782
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
783783
use fs::{File, set_permissions};
784784

@@ -812,7 +812,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
812812
let metadata = reader.metadata()?;
813813
(metadata.permissions(), metadata.size())
814814
};
815-
815+
816816
let mut written = 0u64;
817817
while written < len {
818818
let copy_result = unsafe {

0 commit comments

Comments
 (0)