mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-12 16:26:37 +00:00
lib/model: Leave temp file in place when final rename fails (fixes #3146)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3148
This commit is contained in:
parent
f6cc344623
commit
44290a66b7
@ -1297,8 +1297,9 @@ func (f *rwFolder) performFinish(state *sharedPullerState) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the original content with the new one
|
// Replace the original content with the new one. If it didn't work,
|
||||||
if err := osutil.Rename(state.tempName, state.realName); err != nil {
|
// leave the temp file in place for reuse.
|
||||||
|
if err := osutil.TryRename(state.tempName, state.realName); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user