From 555e70ebecfc3fc28efa1984f9c2b7c392d812cb Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 1 Oct 2014 14:43:22 +0200 Subject: [PATCH] Remove temporary file on hash mismatch (fixes #771) --- internal/model/puller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/model/puller.go b/internal/model/puller.go index 92655e48..eec51265 100644 --- a/internal/model/puller.go +++ b/internal/model/puller.go @@ -563,12 +563,14 @@ func (p *Puller) finisherRoutine(in <-chan *sharedPullerState) { // Verify the file against expected hashes fd, err := os.Open(state.tempName) if err != nil { + os.Remove(state.tempName) l.Warnln("puller: final:", err) continue } err = scanner.Verify(fd, scanner.StandardBlockSize, state.file.Blocks) fd.Close() if err != nil { + os.Remove(state.tempName) l.Warnln("puller: final:", state.file.Name, err) continue }