@@ -538,6 +538,11 @@ impl fmt::Debug for FileTimes {
538538
539539impl Default for FileTimes {
540540 fn default ( ) -> Self {
541+ // Redox doesn't appear to support `UTIME_OMIT`, so we stub it out here, and always return
542+ // an error in `set_times`.
543+ #[ cfg( target_os = "redox" ) ]
544+ let omit = libc:: timespec { tv_sec : 0 , tv_nsec : 0 } ;
545+ #[ cfg( not( target_os = "redox" ) ) ]
541546 let omit = libc:: timespec { tv_sec : 0 , tv_nsec : libc:: UTIME_OMIT as _ } ;
542547 Self ( [ omit; 2 ] )
543548 }
@@ -1064,8 +1069,14 @@ impl File {
10641069
10651070 pub fn set_times ( & self , times : FileTimes ) -> io:: Result < ( ) > {
10661071 cfg_if:: cfg_if! {
1067- // futimens requires macOS 10.13, and Android API level 19
1068- if #[ cfg( any( target_os = "android" , target_os = "macos" ) ) ] {
1072+ if #[ cfg( target_os = "redox" ) ] {
1073+ // Redox doesn't appear to support `UTIME_OMIT`.
1074+ return Err ( io:: const_io_error!(
1075+ io:: ErrorKind :: Unsupported ,
1076+ "setting file times not supported" ,
1077+ ) ) ;
1078+ } else if #[ cfg( any( target_os = "android" , target_os = "macos" ) ) ] {
1079+ // futimens requires macOS 10.13, and Android API level 19
10691080 cvt( unsafe {
10701081 weak!( fn futimens( c_int, * const libc:: timespec) -> c_int) ;
10711082 match futimens. get( ) {
0 commit comments