rootless: do not join namespace if it has already euid == 0

do not attempt to join the rootless namespace if it is running already
with euid == 0.

Closes: https://github.com/containers/libpod/issues/3463

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2019-07-01 21:58:30 +02:00
parent 150778820f
commit 4b176d4f45
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED
1 changed files with 1 additions and 1 deletions

View File

@ -244,7 +244,7 @@ static void __attribute__((constructor)) init()
/* Shortcut. If we are able to join the pause pid file, do it now so we don't
need to re-exec. */
xdg_runtime_dir = getenv ("XDG_RUNTIME_DIR");
if (xdg_runtime_dir && xdg_runtime_dir[0] && can_use_shortcut ())
if (geteuid () != 0 && xdg_runtime_dir && xdg_runtime_dir[0] && can_use_shortcut ())
{
int r;
int fd;