Check errors on test for root namespace

This commit is contained in:
Bryan Boreham committed 2016-03-18 19:39:52 +00:00
1 parent 88cb07203a
commit b00f0aee65
1 file changed
+8 -2
+8 -2
View File
@@ -103,8 +103,14 @@ func linkToNetDev(link netlink.Link) (*NetDev, error) {
// Lookup the weave interface of a container
func GetWeaveNetDevs(processID int) ([]NetDev, error) {
// Bail out if this container is running in the root namespace
nsToplevel, _ := netns.GetFromPid(1)
nsContainr, _ := netns.GetFromPid(processID)
nsToplevel, err := netns.GetFromPid(1)
if err != nil {
return nil, fmt.Errorf("unable to open root namespace: %s", err)
}
nsContainr, err := netns.GetFromPid(processID)
if err != nil {
return nil, fmt.Errorf("unable to open process %d namespace: %s", processID, err)
}
if nsToplevel.Equal(nsContainr) {
return nil, nil
}