mirror of
https://github.com/octoleo/restic.git
synced 2025-02-02 03:48:25 +00:00
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
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…
x
Reference in New Issue
Block a user