lib/osutil: Don't chmod in atomic file creation (fixes #2472)

Instead, trust (and test) that the temp file has appropriate permissions
from the start. The only place where this changes our behavior is for
ignores which go from 0644 to 0600. I'm OK with that.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3756
This commit is contained in:
Jakob Borg
2016-11-23 14:06:08 +00:00
committed by Audrius Butkevicius
parent 26730eb083
commit 8559e20237
6 changed files with 57 additions and 17 deletions

View File

@@ -1248,7 +1248,7 @@ func (m *Model) SetIgnores(folder string, content []string) error {
path := filepath.Join(cfg.Path(), ".stignore")
fd, err := osutil.CreateAtomic(path, 0644)
fd, err := osutil.CreateAtomic(path)
if err != nil {
l.Warnln("Saving .stignore:", err)
return err