forked from TrueCloudLab/restic
cache: Don't Lstat before creating the tag file
The tag file is opened with O_CREATE|O_EXCL and ErrExist is handled, so we don't need to check for existence first.
This commit is contained in:
parent
ab49c14621
commit
2da377c582
1 changed files with 0 additions and 5 deletions
5
internal/cache/cache.go
vendored
5
internal/cache/cache.go
vendored
|
@ -59,11 +59,6 @@ func writeCachedirTag(dir string) error {
|
|||
}
|
||||
|
||||
tagfile := filepath.Join(dir, "CACHEDIR.TAG")
|
||||
_, err := fs.Lstat(tagfile)
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fileMode)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrExist) {
|
||||
|
|
Loading…
Reference in a new issue