mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 11:28:59 +00:00
Remove orphaned temp files before attempting to remove directories (fixes #492)
This commit is contained in:
parent
64ffac5671
commit
0a70e0b7b6
@ -222,7 +222,7 @@ func (p *puller) run() {
|
||||
|
||||
if changed {
|
||||
p.model.setState(p.repoCfg.ID, RepoCleaning)
|
||||
p.fixupDirectories()
|
||||
p.clean()
|
||||
changed = false
|
||||
}
|
||||
|
||||
@ -261,7 +261,9 @@ func (p *puller) runRO() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *puller) fixupDirectories() {
|
||||
// clean deletes orphaned temporary files and directories that should no
|
||||
// longer exist.
|
||||
func (p *puller) clean() {
|
||||
var deleteDirs []string
|
||||
var changed = 0
|
||||
|
||||
@ -270,6 +272,10 @@ func (p *puller) fixupDirectories() {
|
||||
return err
|
||||
}
|
||||
|
||||
if info.Mode().IsRegular() && defTempNamer.IsTemporary(path) {
|
||||
os.Remove(path)
|
||||
}
|
||||
|
||||
if !info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user