SetFileTime
doesn't allow setting the file time to 0xFFFF_FFFF_FFFF_FFFF
This commit is contained in:
parent
39c0b00cf9
commit
c66860ab3e
@ -572,6 +572,14 @@ impl File {
|
|||||||
"Cannot set file timestamp to 0",
|
"Cannot set file timestamp to 0",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
let is_max =
|
||||||
|
|t: c::FILETIME| t.dwLowDateTime == c::DWORD::MAX && t.dwHighDateTime == c::DWORD::MAX;
|
||||||
|
if times.accessed.map_or(false, is_max) || times.modified.map_or(false, is_max) {
|
||||||
|
return Err(io::const_io_error!(
|
||||||
|
io::ErrorKind::InvalidInput,
|
||||||
|
"Cannot set file timestamp to 0xFFFF_FFFF_FFFF_FFFF",
|
||||||
|
));
|
||||||
|
}
|
||||||
cvt(unsafe {
|
cvt(unsafe {
|
||||||
c::SetFileTime(self.as_handle(), None, times.accessed.as_ref(), times.modified.as_ref())
|
c::SetFileTime(self.as_handle(), None, times.accessed.as_ref(), times.modified.as_ref())
|
||||||
})?;
|
})?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user