mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
Only fail after chmod error if permissions differ (e.g. on config file) (#8771)
This commit is contained in:
parent
2321d0db08
commit
2f88dafa56
@ -109,11 +109,17 @@ func (w *AtomicWriter) Close() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if infoErr == nil {
|
if infoErr == nil {
|
||||||
|
// Restore chmod setting for final file to what it was
|
||||||
if err := w.fs.Chmod(w.path, info.Mode()); err != nil {
|
if err := w.fs.Chmod(w.path, info.Mode()); err != nil {
|
||||||
|
// Only fail if permissions differ, since some filesystems are expected to not allow chmod (e.g. error
|
||||||
|
// `operation not permitted`).
|
||||||
|
infoAfterRename, infoAfterRenameErr := w.fs.Lstat(w.path)
|
||||||
|
if infoAfterRenameErr != nil || infoAfterRename.Mode() != info.Mode() {
|
||||||
w.err = err
|
w.err = err
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// fsync the directory too
|
// fsync the directory too
|
||||||
if fd, err := w.fs.Open(filepath.Dir(w.next.Name())); err == nil {
|
if fd, err := w.fs.Open(filepath.Dir(w.next.Name())); err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user