Skip to content

Commit

Permalink
Update library/std/src/sys/pal/windows/fs.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Jonas Böttiger <[email protected]>
  • Loading branch information
cberner and joboet authored Nov 8, 2024
1 parent f1c9904 commit ac66068
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions std/src/sys/pal/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,11 @@ impl File {
cvt(unsafe { c::UnlockFile(self.handle.as_raw_handle(), 0, 0, u32::MAX, u32::MAX) })?;
let result =
cvt(unsafe { c::UnlockFile(self.handle.as_raw_handle(), 0, 0, u32::MAX, u32::MAX) });
if let Err(ref err) = result {
if err.raw_os_error() == Some(c::ERROR_NOT_LOCKED as i32) {
return Ok(());
}
match result {
Ok(_) => Ok(()),
Err(err) if err.raw_os_error() == Some(c::ERROR_NOT_LOCKED as i32) => Ok(()),
Err(err) => Err(err),
}
result?;
Ok(())
}

pub fn truncate(&self, size: u64) -> io::Result<()> {
Expand Down

0 comments on commit ac66068

Please sign in to comment.