Remove temporary file on hash mismatch (fixes #771)
This commit is contained in:
@@ -563,12 +563,14 @@ func (p *Puller) finisherRoutine(in <-chan *sharedPullerState) {
|
|||||||
// Verify the file against expected hashes
|
// Verify the file against expected hashes
|
||||||
fd, err := os.Open(state.tempName)
|
fd, err := os.Open(state.tempName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
os.Remove(state.tempName)
|
||||||
l.Warnln("puller: final:", err)
|
l.Warnln("puller: final:", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err = scanner.Verify(fd, scanner.StandardBlockSize, state.file.Blocks)
|
err = scanner.Verify(fd, scanner.StandardBlockSize, state.file.Blocks)
|
||||||
fd.Close()
|
fd.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
os.Remove(state.tempName)
|
||||||
l.Warnln("puller: final:", state.file.Name, err)
|
l.Warnln("puller: final:", state.file.Name, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user