diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-08-31 09:31:34 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-09-04 14:36:57 +0000 |
commit | 807f6f8d8f98422cfcfe7e474e26a985d951af4d (patch) | |
tree | 6010ce20c6ce8f247cbb8b3e6f29c294521c82ad /libpod | |
parent | bdee681409f595443d4f3cb4f08b76d24139d6a8 (diff) | |
download | podman-807f6f8d8f98422cfcfe7e474e26a985d951af4d.tar.gz podman-807f6f8d8f98422cfcfe7e474e26a985d951af4d.tar.bz2 podman-807f6f8d8f98422cfcfe7e474e26a985d951af4d.zip |
rootless: check uid with Geteuid() instead of Getuid()
change the tests to use chroot to set a numeric UID/GID.
Go syscall.Credential doesn't change the effective UID/GID of the
process.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1372
Approved by: mheon
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/oci_linux.go | 2 | ||||
-rw-r--r-- | libpod/runtime.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go index 335a7eec3..210ba57d1 100644 --- a/libpod/oci_linux.go +++ b/libpod/oci_linux.go @@ -20,7 +20,7 @@ import ( ) func (r *OCIRuntime) moveConmonToCgroup(ctr *Container, cgroupParent string, cmd *exec.Cmd) error { - if os.Getuid() == 0 { + if os.Geteuid() == 0 { if r.cgroupManager == SystemdCgroupsManager { unitName := createUnitName("libpod-conmon", ctr.ID()) diff --git a/libpod/runtime.go b/libpod/runtime.go index da5d9fa70..c405eb773 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -561,7 +561,7 @@ func makeRuntime(runtime *Runtime) (err error) { // empty state only creates a single file // As such, it's not really a performance concern if os.IsNotExist(err) { - if os.Getuid() != 0 { + if os.Geteuid() != 0 { aliveLock.Unlock() locked = false if err2 := runtime.refreshRootless(); err2 != nil { |