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/rootless_unsupported.go | |
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/rootless_unsupported.go')
-rw-r--r-- | pkg/rootless/rootless_unsupported.go | 13 |
1 files changed, 10 insertions, 3 deletions
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 |