Fix error check logic

If copy finished file (err == nil) then
use the error returned from out.Close()
This commit is contained in:
Mikhail Mazurskiy 2020-06-15 22:00:56 +10:00
parent 1fa20301a0
commit b75ea1b052
No known key found for this signature in database
GPG Key ID: FA7917C48932DD55

View File

@ -171,7 +171,7 @@ func copyFile(src, dst string) (err error) {
}
defer func() {
cerr := out.Close()
if cerr == nil {
if err == nil {
err = cerr
}
}()