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:
greatroar 2022-05-10 18:52:39 +02:00
parent ab49c14621
commit 2da377c582
1 changed files with 0 additions and 5 deletions

View File

@ -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) {