Simplify by using GetFromPid
This commit is contained in:
1 parent
adf56d316d
commit
dd74bb1774
1 file changed
+1
-2
+1
-2
@@ -1,7 +1,6 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/vishvananda/netlink"
|
||||
"github.com/vishvananda/netns"
|
||||
"net"
|
||||
@@ -52,7 +51,7 @@ type NetDev struct {
|
||||
func FindNetDevs(processID int, match func(string) bool) ([]NetDev, error) {
|
||||
var netDevs []NetDev
|
||||
|
||||
ns, err := netns.GetFromPath(fmt.Sprintf("/proc/%d/ns/net", processID))
|
||||
ns, err := netns.GetFromPid(processID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user