1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

[net] linux: skip if permission error on getProcInodesAll

This fixes #433
This commit is contained in:
shirou 2017-10-07 11:42:26 +09:00
parent a6cc94f428
commit e01a14e318

View File

@ -322,7 +322,7 @@ func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) {
}
}
if err != nil {
return nil, fmt.Errorf("cound not get pid(s), %d", pid)
return nil, fmt.Errorf("cound not get pid(s), %d: %s", pid, err)
}
return statsFromInodes(root, pid, tmap, inodes)
}
@ -541,6 +541,10 @@ func getProcInodesAll(root string, max int) (map[string][]inodeMap, error) {
for _, pid := range pids {
t, err := getProcInodes(root, pid, max)
if err != nil {
// skip if permission error
if os.IsPermission(err) {
continue
}
return ret, err
}
if len(t) == 0 {