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
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/vishvananda/netlink"
|
"github.com/vishvananda/netlink"
|
||||||
"github.com/vishvananda/netns"
|
"github.com/vishvananda/netns"
|
||||||
"net"
|
"net"
|
||||||
@@ -52,7 +51,7 @@ type NetDev struct {
|
|||||||
func FindNetDevs(processID int, match func(string) bool) ([]NetDev, error) {
|
func FindNetDevs(processID int, match func(string) bool) ([]NetDev, error) {
|
||||||
var netDevs []NetDev
|
var netDevs []NetDev
|
||||||
|
|
||||||
ns, err := netns.GetFromPath(fmt.Sprintf("/proc/%d/ns/net", processID))
|
ns, err := netns.GetFromPid(processID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user