Skip to content

Commit

Permalink
Extract name before closing.
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Aug 18, 2024
1 parent 2b70dd6 commit 0e66780
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion atomicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ func (f *File) Cancel() {
// The check averts an A-B-A conflict during the window after renaming.
if tmp := f.tmp; tmp != nil {
f.tmp = nil
name := tmp.Name()
tmp.Close()
os.Remove(tmp.Name())
os.Remove(name)
}
}

Expand Down

0 comments on commit 0e66780

Please sign in to comment.