mirror of
https://github.com/golang/go
synced 2024-11-24 04:30:14 -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")
|
fmt.Println("OK")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -30,7 +30,9 @@ func tidExists(tid int) (exists, supported bool, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, false, err
|
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 {
|
if err != nil {
|
||||||
return false, false, err
|
return false, false, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user