flatpak-enter: warn when not running as root

Currently, all conceivable configurations and installations of
flatpak require root to perform this operation. That may not be
the case in the future, but until then, we should warn when the
user is not root as the operation will fail.

Fixes https://github.com/flatpak/flatpak/issues/855
tingping/wmclass
Christian Hergert 2017-07-09 14:24:21 -07:00
parent 3259704a06
commit 7bf60270fe
1 changed files with 4 additions and 0 deletions

View File

@ -104,6 +104,10 @@ flatpak_builtin_enter (int argc,
return FALSE;
}
/* Before further checks, warn if we are not already root */
if (geteuid () != 0)
g_printerr ("%s\n", _("Not running as root, may be unable to enter namespace"));
pid_s = argv[rest_argv_start];
pid = atoi (pid_s);