diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-15 07:28:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-15 07:28:42 -0700 |
commit | 8aed32acea9bb35898abcee58fc9aa2a03ef264a (patch) | |
tree | a9ea0713cd50e464a4f38d000bfe1256b67acf77 | |
parent | a73814cc6778c08b187e248219d5cfc8fb57b182 (diff) | |
parent | e6a4bac09e5ffff47a6a28ac09179a60526bbf0b (diff) | |
download | podman-8aed32acea9bb35898abcee58fc9aa2a03ef264a.tar.gz podman-8aed32acea9bb35898abcee58fc9aa2a03ef264a.tar.bz2 podman-8aed32acea9bb35898abcee58fc9aa2a03ef264a.zip |
Merge pull request #2655 from giuseppe/tmp-user
rootless: use /tmp/libpod-rundir-$EUID for fallback
-rw-r--r-- | pkg/rootless/rootless_linux.go | 2 | ||||
-rw-r--r-- | pkg/util/utils.go | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index b2677f7d9..baceebee3 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -72,7 +72,7 @@ func GetRootlessUID() int { u, _ := strconv.Atoi(uidEnv) return u } - return os.Getuid() + return os.Geteuid() } func tryMappingTool(tool string, pid int, hostID int, mappings []idtools.IDMap) error { diff --git a/pkg/util/utils.go b/pkg/util/utils.go index d7e1ddd38..73dddf2ac 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -190,15 +190,15 @@ func GetRootlessRuntimeDir() (string, error) { tmpDir := filepath.Join("/run", "user", uid) os.MkdirAll(tmpDir, 0700) st, err := os.Stat(tmpDir) - if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Getuid() && st.Mode().Perm() == 0700 { + if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && st.Mode().Perm() == 0700 { runtimeDir = tmpDir } } if runtimeDir == "" { - tmpDir := filepath.Join(os.TempDir(), "user", uid) + tmpDir := filepath.Join(os.TempDir(), fmt.Sprintf("libpod-rundir-%s", uid)) os.MkdirAll(tmpDir, 0700) st, err := os.Stat(tmpDir) - if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Getuid() && st.Mode().Perm() == 0700 { + if err == nil && int(st.Sys().(*syscall.Stat_t).Uid) == os.Geteuid() && st.Mode().Perm() == 0700 { runtimeDir = tmpDir } } |