mirror of
https://github.com/clearlinux/rkt.git
synced 2026-09-07 14:22:02 +00:00
Merge pull request #525 from endocode/alban/withNetNS
net: withNetNS: attempt to revert net ns in case of error
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user