Merge pull request #205 from hugoduncan/fix-leaking-fd-in-netns

Fix leaking file descriptor in NetNs strategy
This commit is contained in:
Victor Marmol 2014-09-25 13:23:10 -07:00
commit 30e50af760
1 changed files with 2 additions and 0 deletions

View File

@ -30,8 +30,10 @@ func (v *NetNS) Initialize(config *Network, networkState *NetworkState) error {
}
if err := system.Setns(f.Fd(), syscall.CLONE_NEWNET); err != nil {
f.Close()
return fmt.Errorf("failed to setns current network namespace: %v", err)
}
f.Close()
return nil
}