mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Must verify success of from-network copy during upgrade (ref #1138)
This commit is contained in:
parent
7344a6205f
commit
23085eb5ae
@ -120,9 +120,6 @@ func readTarGZ(url string, dir string) (string, error) {
|
||||
}
|
||||
|
||||
tr := tar.NewReader(gr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Iterate through the files in the archive.
|
||||
for {
|
||||
@ -143,14 +140,25 @@ func readTarGZ(url string, dir string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
io.Copy(of, tr)
|
||||
|
||||
_, err = io.Copy(of, tr)
|
||||
if err != nil {
|
||||
os.Remove(of.Name())
|
||||
return "", err
|
||||
}
|
||||
|
||||
err = of.Close()
|
||||
if err != nil {
|
||||
os.Remove(of.Name())
|
||||
return "", err
|
||||
}
|
||||
|
||||
os.Chmod(of.Name(), os.FileMode(hdr.Mode))
|
||||
err = os.Chmod(of.Name(), os.FileMode(hdr.Mode))
|
||||
if err != nil {
|
||||
os.Remove(of.Name())
|
||||
return "", err
|
||||
}
|
||||
|
||||
return of.Name(), nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user