summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-07-05 10:50:41 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-05 13:30:15 +0000
commit77758a6c9f74da42aad70ab74d6c68b2878d3ee0 (patch)
tree8e55466cef99a0e813163bd543ccc844c0bf0769 /libpod/oci.go
parentbaa42fd4bd295be9232cde8e528841d3e8fd7d35 (diff)
downloadpodman-77758a6c9f74da42aad70ab74d6c68b2878d3ee0.tar.gz
podman-77758a6c9f74da42aad70ab74d6c68b2878d3ee0.tar.bz2
podman-77758a6c9f74da42aad70ab74d6c68b2878d3ee0.zip
rootless: set XDG_RUNTIME_DIR also for state and exec
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1048 Approved by: mheon
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index 3a7d6be3a..20d533726 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -425,7 +425,10 @@ func (r *OCIRuntime) updateContainerStatus(ctr *Container) error {
// Store old state so we know if we were already stopped
oldState := ctr.state.State
- out, err := exec.Command(r.path, "state", ctr.ID()).CombinedOutput()
+ cmd := exec.Command(r.path, "state", ctr.ID())
+ cmd.Env = append(cmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", GetRootlessRuntimeDir()))
+
+ out, err := cmd.CombinedOutput()
if err != nil {
if strings.Contains(string(out), "does not exist") {
ctr.removeConmonFiles()
@@ -654,7 +657,7 @@ func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty
execCmd.Stdout = os.Stdout
execCmd.Stderr = os.Stderr
execCmd.Stdin = os.Stdin
-
+ execCmd.Env = append(execCmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", GetRootlessRuntimeDir()))
return execCmd, nil
}