Merge pull request #525 from endocode/alban/withNetNS

net: withNetNS: attempt to revert net ns in case of error
This commit is contained in:
Eugene Yakubovich
2015-03-05 17:32:22 -08:00
+4
View File
@@ -266,6 +266,10 @@ func withNetNS(curNS, tgtNS *os.File, f func() error) error {
}
if err := f(); err != nil {
// Attempt to revert the net ns in a known state
if err := util.SetNS(curNS, syscall.CLONE_NEWNET); err != nil {
log.Printf("Cannot revert the net namespace: %v", err)
}
return err
}