mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
parent
fa9bc08afb
commit
9c2117f08e
@ -93,12 +93,12 @@ func (w *AtomicWriter) Close() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
info, err := w.fs.Lstat(w.path)
|
info, infoErr := w.fs.Lstat(w.path)
|
||||||
if err != nil && !fs.IsNotExist(err) {
|
if infoErr != nil && !fs.IsNotExist(infoErr) {
|
||||||
w.err = err
|
w.err = infoErr
|
||||||
return err
|
return infoErr
|
||||||
}
|
}
|
||||||
err = w.fs.Rename(w.next.Name(), w.path)
|
err := w.fs.Rename(w.next.Name(), w.path)
|
||||||
if runtime.GOOS == "windows" && fs.IsPermission(err) {
|
if runtime.GOOS == "windows" && fs.IsPermission(err) {
|
||||||
// On Windows, we might not be allowed to rename over the file
|
// On Windows, we might not be allowed to rename over the file
|
||||||
// because it's read-only. Get us some write permissions and try
|
// because it's read-only. Get us some write permissions and try
|
||||||
@ -110,7 +110,7 @@ func (w *AtomicWriter) Close() error {
|
|||||||
w.err = err
|
w.err = err
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if info != nil {
|
if infoErr == nil {
|
||||||
if err := w.fs.Chmod(w.path, info.Mode()); err != nil {
|
if err := w.fs.Chmod(w.path, info.Mode()); err != nil {
|
||||||
w.err = err
|
w.err = err
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user