libnetwork/rootlessnetns: do not cleanup twice in Run()
This here just logs unnecessary errors in case there is an error during the Run() call (podman unshare --rootless-netns). runInner() will already call cleanup on errors if it created a new netns so we only need to cleanup when there is no error. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
2589ef49aa
commit
7c89762d52
|
|
@ -584,15 +584,12 @@ func (n *Netns) Run(lock *lockfile.LockFile, toRun func() error) error {
|
|||
logrus.Errorf("Failed to decrement ref count: %v", err)
|
||||
return inErr
|
||||
}
|
||||
if count == 0 {
|
||||
// runInner() already cleans up the netns when it created a new one on errors
|
||||
// so we only need to do that if there was no error.
|
||||
if inErr == nil && count == 0 {
|
||||
err = n.cleanup()
|
||||
if err != nil {
|
||||
err = wrapError("cleanup", err)
|
||||
if inErr == nil {
|
||||
return err
|
||||
}
|
||||
logrus.Errorf("Failed to cleanup rootless netns: %v", err)
|
||||
return inErr
|
||||
return wrapError("cleanup", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue