@@ -538,6 +538,11 @@ impl fmt::Debug for FileTimes {
538
538
539
539
impl Default for FileTimes {
540
540
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" ) ) ]
541
546
let omit = libc:: timespec { tv_sec : 0 , tv_nsec : libc:: UTIME_OMIT as _ } ;
542
547
Self ( [ omit; 2 ] )
543
548
}
@@ -1064,8 +1069,14 @@ impl File {
1064
1069
1065
1070
pub fn set_times ( & self , times : FileTimes ) -> io:: Result < ( ) > {
1066
1071
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
1069
1080
cvt( unsafe {
1070
1081
weak!( fn futimens( c_int, * const libc:: timespec) -> c_int) ;
1071
1082
match futimens. get( ) {
0 commit comments