mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 00:34:10 -04:00
Properly close the file in makeFile
This commit is contained in:
parent
53b3c8968e
commit
7c26e11d6f
1 changed files with 3 additions and 1 deletions
|
|
@ -489,7 +489,9 @@ func makeDir(pathname string) error {
|
|||
// If pathname already exists, whether a file or directory, no error is returned.
|
||||
func makeFile(pathname string) error {
|
||||
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
|
||||
defer f.Close()
|
||||
if f != nil {
|
||||
f.Close()
|
||||
}
|
||||
if err != nil {
|
||||
if !os.IsExist(err) {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue