mirror of
https://github.com/golang/go
synced 2024-11-24 00:00:23 -07:00
runtime/testdata/testprog: close files in the tidExists GCFairness func
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
parent
334ce51004
commit
84b1182233
2
src/runtime/testdata/testprog/gc.go
vendored
2
src/runtime/testdata/testprog/gc.go
vendored
@ -73,6 +73,8 @@ func GCFairness() {
|
||||
fmt.Println("OK")
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
@ -30,7 +30,9 @@ func tidExists(tid int) (exists, supported bool, err error) {
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
}
|
||||
status, err := io.ReadAll(os.NewFile(uintptr(fd), statusFile))
|
||||
f := os.NewFile(uintptr(fd), statusFile)
|
||||
defer f.Close()
|
||||
status, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user