Commit 22c56d29 authored by tycho garen's avatar tycho garen

close open files

parent f8610342
......@@ -104,6 +104,7 @@ func Users() ([]UserStat, error) {
if err != nil {
return ret, err
}
defer file.Close()
buf, err := ioutil.ReadAll(file)
if err != nil {
......
......@@ -112,6 +112,7 @@ func Users() ([]UserStat, error) {
if err != nil {
return ret, err
}
defer file.Close()
buf, err := ioutil.ReadAll(file)
if err != nil {
......@@ -180,6 +181,8 @@ func getUsersFromUtmp(utmpfile string) ([]UserStat, error) {
if err != nil {
return ret, err
}
defer file.Close()
buf, err := ioutil.ReadAll(file)
if err != nil {
return ret, err
......
......@@ -131,6 +131,7 @@ func Users() ([]UserStat, error) {
if err != nil {
return nil, err
}
defer file.Close()
buf, err := ioutil.ReadAll(file)
if err != nil {
......
......@@ -123,6 +123,8 @@ func Users() ([]UserStat, error) {
if err != nil {
return ret, err
}
defer file.Close()
buf, err := ioutil.ReadAll(file)
if err != nil {
return ret, err
......
......@@ -33,9 +33,9 @@ func NumProcs() (uint64, error) {
if err != nil {
return 0, err
}
defer f.Close()
list, err := f.Readdir(-1)
defer f.Close()
if err != nil {
return 0, err
}
......
......@@ -40,6 +40,8 @@ func getTerminalMap() (map[uint64]string, error) {
return nil, err
}
}
defer ptsd.Close()
if ptsnames == nil {
defer ptsd.Close()
ptsnames, err = ptsd.Readdirnames(-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment