Skip to content

Commit e387cff

Browse files
committed
Also use fallback for futimens on Android
futimens requires Android API level 19, and std still supports older API levels.
1 parent 828b637 commit e387cff

File tree

1 file changed

+3
-3
lines changed
  • library/std/src/sys/unix

1 file changed

+3
-3
lines changed

library/std/src/sys/unix/fs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
1919
target_os = "ios",
2020
))]
2121
use crate::sys::weak::syscall;
22-
#[cfg(target_os = "macos")]
22+
#[cfg(any(target_os = "android", target_os = "macos"))]
2323
use crate::sys::weak::weak;
2424

2525
use libc::{c_int, mode_t};
@@ -1064,8 +1064,8 @@ impl File {
10641064

10651065
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
10661066
cfg_if::cfg_if! {
1067-
// futimens requires macOS 10.13
1068-
if #[cfg(target_os = "macos")] {
1067+
// futimens requires macOS 10.13, and Android API level 19
1068+
if #[cfg(any(target_os = "android", target_os = "macos"))] {
10691069
fn ts_to_tv(ts: &libc::timespec) -> libc::timeval {
10701070
libc::timeval { tv_sec: ts.tv_sec, tv_usec: (ts.tv_nsec / 1000) as _ }
10711071
}

0 commit comments

Comments
 (0)