Merge pull request #28577 from chchliang/defercode

function setupOOMScoreAdj file close illogicality
This commit is contained in:
Brian Goff 2016-11-18 11:48:58 -05:00 committed by GitHub
commit 06e92cc2c1

View file

@ -1227,7 +1227,7 @@ func setupOOMScoreAdj(score int) error {
if err != nil {
return err
}
defer f.Close()
stringScore := strconv.Itoa(score)
_, err = f.WriteString(stringScore)
if os.IsPermission(err) {
@ -1239,7 +1239,7 @@ func setupOOMScoreAdj(score int) error {
}
return nil
}
f.Close()
return err
}