Fix the net.ConnectionsMax BUG
`connectionsList, err := net.ConnectionsMax("tcp4", 1000)` when you run net.ConnectionsMax,you will find some proc is not equal with the `netstat -lptn`
This commit is contained in:
parent
35f21af98a
commit
809306b78a
|
@ -14,6 +14,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"io"
|
||||
|
||||
"github.com/shirou/gopsutil/internal/common"
|
||||
)
|
||||
|
@ -653,7 +654,7 @@ func getProcInodesAll(root string, max int) (map[string][]inodeMap, error) {
|
|||
t, err := getProcInodes(root, pid, max)
|
||||
if err != nil {
|
||||
// skip if permission error or no longer exists
|
||||
if os.IsPermission(err) || os.IsNotExist(err) {
|
||||
if os.IsPermission(err) || os.IsNotExist(err) || err == io.EOF {
|
||||
continue
|
||||
}
|
||||
return ret, err
|
||||
|
|
Loading…
Reference in New Issue