mirror of
https://github.com/octoleo/restic.git
synced 2024-11-30 00:33:57 +00:00
Merge pull request #3746 from greatroar/cache-lstat
cache: Don't Lstat before creating CACHEDIR.TAG
This commit is contained in:
commit
47c56dea5c
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")
|
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)
|
f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fileMode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, os.ErrExist) {
|
if errors.Is(err, os.ErrExist) {
|
||||||
|
Loading…
Reference in New Issue
Block a user