summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-18 21:19:00 +0100
committerGitHub <noreply@github.com>2020-02-18 21:19:00 +0100
commit3be1221aea406b38741598038532e43714619127 (patch)
tree33258bf1c8231627affadc722c5eb69e929843c6 /libpod/oci_conmon_linux.go
parent931eb1b58314d3385ab48601cb2cc3bd0c371196 (diff)
parent170fd7b038757228bf169e6180cab19a1e412f26 (diff)
downloadpodman-3be1221aea406b38741598038532e43714619127.tar.gz
podman-3be1221aea406b38741598038532e43714619127.tar.bz2
podman-3be1221aea406b38741598038532e43714619127.zip
Merge pull request #5245 from giuseppe/rootless-portmapping-detach
rootless: fix a regression when using -d
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r--libpod/oci_conmon_linux.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 722012386..07d38693f 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1161,6 +1161,13 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co
if ctr.config.NetMode.IsSlirp4netns() {
if ctr.config.PostConfigureNetNS {
+ havePortMapping := len(ctr.Config().PortMappings) > 0
+ if havePortMapping {
+ ctr.rootlessPortSyncR, ctr.rootlessPortSyncW, err = os.Pipe()
+ if err != nil {
+ return errors.Wrapf(err, "failed to create rootless port sync pipe")
+ }
+ }
ctr.rootlessSlirpSyncR, ctr.rootlessSlirpSyncW, err = os.Pipe()
if err != nil {
return errors.Wrapf(err, "failed to create rootless network sync pipe")
@@ -1176,9 +1183,6 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co
// Leak one end in conmon, the other one will be leaked into slirp4netns
cmd.ExtraFiles = append(cmd.ExtraFiles, ctr.rootlessSlirpSyncW)
- if ctr.rootlessPortSyncR != nil {
- defer errorhandling.CloseQuiet(ctr.rootlessPortSyncR)
- }
if ctr.rootlessPortSyncW != nil {
defer errorhandling.CloseQuiet(ctr.rootlessPortSyncW)
// Leak one end in conmon, the other one will be leaked into rootlessport