mirror of https://github.com/containers/podman.git
refresh: do not access network ns if not in the namespace
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
c3c40f970e
commit
78bf6d0c6e
|
@ -2,6 +2,7 @@ package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -658,9 +659,13 @@ func (s *BoltState) UpdateContainer(ctr *Container) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle network namespace
|
// Handle network namespace.
|
||||||
if err := replaceNetNS(netNSPath, ctr, newState); err != nil {
|
if os.Geteuid() == 0 {
|
||||||
return err
|
// Do it only when root, either on the host or as root in the
|
||||||
|
// user namespace.
|
||||||
|
if err := replaceNetNS(netNSPath, ctr, newState); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New state compiled successfully, swap it into the current state
|
// New state compiled successfully, swap it into the current state
|
||||||
|
|
Loading…
Reference in New Issue