summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-22 14:39:49 +0100
committerGitHub <noreply@github.com>2020-01-22 14:39:49 +0100
commit55abb6d3fa9afa26d9ce3af0106cabc39047cc2e (patch)
tree73838c372c342e1af44312c276b4b550d763c3a0 /pkg
parentd52132b6ecc1c1c9fb955ecee629f8d169ef1119 (diff)
parentab7744d3c1eee13a30c9f80a60251cd93f6f5160 (diff)
downloadpodman-55abb6d3fa9afa26d9ce3af0106cabc39047cc2e.tar.gz
podman-55abb6d3fa9afa26d9ce3af0106cabc39047cc2e.tar.bz2
podman-55abb6d3fa9afa26d9ce3af0106cabc39047cc2e.zip
Merge pull request #4911 from giuseppe/rootless-set-containers-env
rootless: set C variables also on shortcut
Diffstat (limited to 'pkg')
-rw-r--r--pkg/rootless/rootless_linux.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c
index 193c788c0..041a161dc 100644
--- a/pkg/rootless/rootless_linux.c
+++ b/pkg/rootless/rootless_linux.c
@@ -266,6 +266,8 @@ static void __attribute__((constructor)) init()
char path[PATH_MAX];
const char *const suffix = "/libpod/pause.pid";
char *cwd = getcwd (NULL, 0);
+ char uid_fmt[16];
+ char gid_fmt[16];
if (cwd == NULL)
{
@@ -324,6 +326,13 @@ static void __attribute__((constructor)) init()
exit (EXIT_FAILURE);
}
+ sprintf (uid_fmt, "%d", uid);
+ sprintf (gid_fmt, "%d", gid);
+
+ setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1);
+ setenv ("_CONTAINERS_ROOTLESS_UID", uid_fmt, 1);
+ setenv ("_CONTAINERS_ROOTLESS_GID", gid_fmt, 1);
+
r = setns (fd, 0);
if (r < 0)
{