mirror of
https://github.com/restic/restic.git
synced 2025-01-22 23:38:37 +00:00
cache: Don't recreate CACHEDIR.TAG
This commit is contained in:
parent
b511f4dce2
commit
bd742ddb69
1 changed files with 7 additions and 1 deletions
8
internal/cache/cache.go
vendored
8
internal/cache/cache.go
vendored
|
@ -61,7 +61,13 @@ func writeCachedirTag(dir string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := fs.OpenFile(filepath.Join(dir, "CACHEDIR.TAG"), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
|
tagfile := filepath.Join(dir, "CACHEDIR.TAG")
|
||||||
|
_, err := fs.Lstat(tagfile)
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
return errors.Wrap(err, "Lstat")
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsExist(errors.Cause(err)) {
|
if os.IsExist(errors.Cause(err)) {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue