mirror of
https://github.com/restic/restic.git
synced 2024-12-23 00:07:25 +00:00
start using fileMode const
This commit is contained in:
parent
38ea7ed4f6
commit
e19622e4b1
1 changed files with 3 additions and 3 deletions
6
internal/cache/cache.go
vendored
6
internal/cache/cache.go
vendored
|
@ -24,7 +24,7 @@ type Cache struct {
|
|||
}
|
||||
|
||||
const dirMode = 0700
|
||||
const fileMode = 0600
|
||||
const fileMode = 0644
|
||||
|
||||
func readVersion(dir string) (v uint, err error) {
|
||||
buf, err := ioutil.ReadFile(filepath.Join(dir, "version"))
|
||||
|
@ -68,7 +68,7 @@ func writeCachedirTag(dir string) error {
|
|||
return errors.Wrap(err, "Lstat")
|
||||
}
|
||||
|
||||
f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
|
||||
f, err := fs.OpenFile(tagfile, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fileMode)
|
||||
if err != nil {
|
||||
if os.IsExist(errors.Cause(err)) {
|
||||
return nil
|
||||
|
@ -138,7 +138,7 @@ func New(id string, basedir string) (c *Cache, err error) {
|
|||
}
|
||||
|
||||
if v < cacheVersion {
|
||||
err = ioutil.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), 0644)
|
||||
err = ioutil.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), fileMode)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "WriteFile")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue