Skip to content

Commit 1e3e5df

Browse files
committed
fix: propagate error on target.Close() in copyFile
1 parent a04eed8 commit 1e3e5df

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pkg/unikontainers/utils.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ func copyFile(sourceFile string, targetPath string) error {
6262
if err != nil {
6363
return err
6464
}
65-
defer target.Close()
6665

6766
_, err = io.Copy(target, source)
67+
68+
closeErr := target.Close()
69+
6870
if err != nil {
6971
return err
7072
}
71-
72-
return nil
73+
74+
return closeErr
7375
}
7476

7577
// move sourceFile to targetDir

0 commit comments

Comments
 (0)