Skip to content

Commit

Permalink
Merge pull request #1105 from fmarmol/master
Browse files Browse the repository at this point in the history
Switch usage from os.*File.Readdir to os.*File.ReadDir.
  • Loading branch information
shirou authored Oct 30, 2021
2 parents 0c09b2c + 27a70bc commit 9bbd81f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions v3/net/net_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,12 @@ func getProcInodes(root string, pid int32, max int) (map[string][]inodeMap, erro
return ret, err
}
defer f.Close()
files, err := f.Readdir(max)
dirEntries, err := f.ReadDir(max)
if err != nil {
return ret, err
}
for _, fd := range files {
inodePath := fmt.Sprintf("%s/%d/fd/%s", root, pid, fd.Name())
for _, dirEntry := range dirEntries {
inodePath := fmt.Sprintf("%s/%d/fd/%s", root, pid, dirEntry.Name())

inode, err := os.Readlink(inodePath)
if err != nil {
Expand All @@ -566,7 +566,7 @@ func getProcInodes(root string, pid int32, max int) (map[string][]inodeMap, erro
if !ok {
ret[inode] = make([]inodeMap, 0)
}
fd, err := strconv.Atoi(fd.Name())
fd, err := strconv.Atoi(dirEntry.Name())
if err != nil {
continue
}
Expand Down

0 comments on commit 9bbd81f

Please sign in to comment.