summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-06-13 16:59:47 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-08-16 21:55:16 -0400
commitb3ebd4e10650f78118e4481926827b4c94b8a684 (patch)
treed6175210701334bd95c8cd8312cbd373375ea7d0
parentc78e01b44da66f9e57a74b4b15fa2890b852b43f (diff)
nspawn: if !cg_ns_supported() then force arg_use_cgns = false
It's silly that every time we check arg_use_cgns we also have to check cg_ns_supported(). So, simplify these checks and force arg_use_cgns = false if the kernel doesn't support cg_ns_supported.
-rw-r--r--src/nspawn/nspawn.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 96ea27e57c..7fddee8808 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1379,7 +1379,7 @@ static int parse_argv(int argc, char *argv[]) {
if (r < 0)
arg_use_cgns = cg_ns_supported();
else
- arg_use_cgns = r;
+ arg_use_cgns = r && cg_ns_supported();
r = custom_mount_check_all();
if (r < 0)
@@ -2601,7 +2601,7 @@ static int inner_child(
return -ESRCH;
}
- if (arg_use_cgns && cg_ns_supported()) {
+ if (arg_use_cgns) {
r = unshare(CLONE_NEWCGROUP);
if (r < 0)
return log_error_errno(errno, "Failed to unshare cgroup namespace: %m");
@@ -3065,7 +3065,7 @@ static int outer_child(
if (r < 0)
return r;
- if (!arg_use_cgns || !cg_ns_supported()) {
+ if (!arg_use_cgns) {
r = mount_cgroups(
directory,
arg_inner_cgver,