mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-11 17:31:35 +00:00
internal/download: clean it up
This commit is contained in:
parent
51885e45fd
commit
4ae069fd76
1 changed files with 4 additions and 4 deletions
|
|
@ -209,11 +209,11 @@ func (db *ChecksumDB) DownloadFile(url, dstPath string) error {
|
||||||
if resp.ContentLength > 0 {
|
if resp.ContentLength > 0 {
|
||||||
dst = newDownloadWriter(fd, resp.ContentLength)
|
dst = newDownloadWriter(fd, resp.ContentLength)
|
||||||
}
|
}
|
||||||
_, err = io.Copy(dst, resp.Body)
|
if _, err = io.Copy(dst, resp.Body); err != nil {
|
||||||
if closeErr := dst.Close(); err == nil {
|
os.Remove(tmpfile)
|
||||||
err = closeErr
|
return err
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err = dst.Close(); err != nil {
|
||||||
os.Remove(tmpfile)
|
os.Remove(tmpfile)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue