pinakes-core: check file existence before removal in TempFileGuard drop
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I800825f5dc3b526d350931ff8f1ed0da6a6a6964
This commit is contained in:
parent
0c9b71346d
commit
0ba898c881
1 changed files with 5 additions and 1 deletions
|
|
@ -27,7 +27,11 @@ impl TempFileGuard {
|
|||
|
||||
impl Drop for TempFileGuard {
|
||||
fn drop(&mut self) {
|
||||
let _ = std::fs::remove_file(&self.0);
|
||||
if self.0.exists() {
|
||||
if let Err(e) = std::fs::remove_file(&self.0) {
|
||||
warn!("failed to clean up temp file {}: {e}", self.0.display());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue