Fix HorizonOS regression in FileTimes

This commit is contained in:
Andrea Ciliberti 2022-08-07 19:30:05 +02:00
parent 5a9c3a2daa
commit 926f58745e

View File

@ -544,11 +544,11 @@ impl Default for FileTimes {
fn default() -> Self { fn default() -> Self {
// Redox doesn't appear to support `UTIME_OMIT`, so we stub it out here, and always return // Redox doesn't appear to support `UTIME_OMIT`, so we stub it out here, and always return
// an error in `set_times`. // an error in `set_times`.
// ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore // ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
// the same as for Redox. // the same as for Redox.
#[cfg(any(target_os = "redox", target_os = "espidf"))] #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon"))]
let omit = libc::timespec { tv_sec: 0, tv_nsec: 0 }; let omit = libc::timespec { tv_sec: 0, tv_nsec: 0 };
#[cfg(not(any(target_os = "redox", target_os = "espidf")))] #[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "horizon")))]
let omit = libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }; let omit = libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ };
Self([omit; 2]) Self([omit; 2])
} }
@ -1079,9 +1079,9 @@ impl File {
pub fn set_times(&self, times: FileTimes) -> io::Result<()> { pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(any(target_os = "redox", target_os = "espidf"))] { if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon"))] {
// Redox doesn't appear to support `UTIME_OMIT`. // Redox doesn't appear to support `UTIME_OMIT`.
// ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore // ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
// the same as for Redox. // the same as for Redox.
drop(times); drop(times);
Err(io::const_io_error!( Err(io::const_io_error!(