Commit 7ee895e4 by Daniel Lezcano Committed by Daniel Lezcano

don't play with the capabilities when we are root

We don't want to drop the capabilities when we are root because that leads to some problems. For exemple, sudo lxc-start -n foo -o $(tty) fails with "permission denied". Signed-off-by: 's avatarDaniel Lezcano <daniel.lezcano@free.fr>
parent b3ecde1e
......@@ -54,6 +54,11 @@ int lxc_caps_down(void)
cap_t caps;
int ret;
/* when we are run as root, we don't want to play
* with the capabilities */
if (!getuid())
return 0;
caps = cap_get_proc();
if (!caps) {
ERROR("failed to cap_get_proc: %m");
......@@ -83,6 +88,11 @@ int lxc_caps_up(void)
cap_value_t cap;
int ret;
/* when we are run as root, we don't want to play
* with the capabilities */
if (!getuid())
return 0;
caps = cap_get_proc();
if (!caps) {
ERROR("failed to cap_get_proc: %m");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment