diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-03 15:58:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-03 15:58:26 +0200 |
commit | a22a32a0a5507811168e0251a92122cf3e74ef51 (patch) | |
tree | 28f9cd8cfb7b45bf94e5c84b0cb19136c95c6749 /pkg/rootless | |
parent | bf7d5a9ce8455e4480b5e0ef92b02099f119ee71 (diff) | |
parent | 473d0604546ef472f167ee671fdf1110bf74eb63 (diff) | |
download | podman-a22a32a0a5507811168e0251a92122cf3e74ef51.tar.gz podman-a22a32a0a5507811168e0251a92122cf3e74ef51.tar.bz2 podman-a22a32a0a5507811168e0251a92122cf3e74ef51.zip |
Merge pull request #3437 from giuseppe/fix-nocgo
build: allow to build without cgo on RISC-V
Diffstat (limited to 'pkg/rootless')
-rw-r--r-- | pkg/rootless/rootless_linux.go | 2 | ||||
-rw-r--r-- | pkg/rootless/rootless_unsupported.go | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index d51f32d68..f3b9a8fd5 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,cgo package rootless diff --git a/pkg/rootless/rootless_unsupported.go b/pkg/rootless/rootless_unsupported.go index 52863580e..a8485c083 100644 --- a/pkg/rootless/rootless_unsupported.go +++ b/pkg/rootless/rootless_unsupported.go @@ -1,14 +1,21 @@ -// +build !linux +// +build !linux !cgo package rootless import ( + "os" + "github.com/pkg/errors" ) -// IsRootless returns false on all non-linux platforms +// IsRootless returns whether the user is rootless func IsRootless() bool { - return false + uid := os.Geteuid() + // os.Geteuid() on Windows returns -1 + if uid == -1 { + return false + } + return uid != 0 } // BecomeRootInUserNS re-exec podman in a new userNS. It returns whether podman was re-executed |