diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2022-06-27 11:05:10 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2022-07-15 02:54:06 -0700 |
| commit | e387cff7a3eb442aa0a0b84a3ebb6f170e205ea2 (patch) | |
| tree | 0944bfe14dcb1b8c7690b8c7b3ee06f9ffd42dcd | |
| parent | 828b637c2a37c85f8d3734d57ad459868ea31584 (diff) | |
| download | rust-e387cff7a3eb442aa0a0b84a3ebb6f170e205ea2.tar.gz rust-e387cff7a3eb442aa0a0b84a3ebb6f170e205ea2.zip | |
Also use fallback for futimens on Android
futimens requires Android API level 19, and std still supports older API levels.
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index db81b26e7e7..91deff71e42 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -19,7 +19,7 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; target_os = "ios", ))] use crate::sys::weak::syscall; -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "android", target_os = "macos"))] use crate::sys::weak::weak; use libc::{c_int, mode_t}; @@ -1064,8 +1064,8 @@ impl File { pub fn set_times(&self, times: FileTimes) -> io::Result<()> { cfg_if::cfg_if! { - // futimens requires macOS 10.13 - if #[cfg(target_os = "macos")] { + // futimens requires macOS 10.13, and Android API level 19 + if #[cfg(any(target_os = "android", target_os = "macos"))] { fn ts_to_tv(ts: &libc::timespec) -> libc::timeval { libc::timeval { tv_sec: ts.tv_sec, tv_usec: (ts.tv_nsec / 1000) as _ } } |
