mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-05 04:38:16 +00:00
Properly close the file in makeFile
This commit is contained in:
@@ -489,7 +489,9 @@ func makeDir(pathname string) error {
|
|||||||
// If pathname already exists, whether a file or directory, no error is returned.
|
// If pathname already exists, whether a file or directory, no error is returned.
|
||||||
func makeFile(pathname string) error {
|
func makeFile(pathname string) error {
|
||||||
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
|
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
|
||||||
defer f.Close()
|
if f != nil {
|
||||||
|
f.Close()
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !os.IsExist(err) {
|
if !os.IsExist(err) {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user