1
0
Fork 0
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:
Alexander Neumann 2018-07-08 12:05:12 +02:00
parent b511f4dce2
commit bd742ddb69

View file

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