diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-02-24 17:52:58 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-02-24 17:52:58 +0100 |
commit | b4cccbc13ad6f98bd8e816ce5fffb99f5be74c8c (patch) | |
tree | 14313f0bd5cd2dad79fda852663d9038f81a35ad /src/nspawn/nspawn.c | |
parent | fc9ae7178e1462377b272a14b1a763d480ab0980 (diff) |
cgroup: change cg_unified() to possibly return errors again
We use our cgroup APIs in various contexts, including from our libraries
sd-login, sd-bus. As we don#t control those environments we can't rely
that the unified cgroup setup logic succeeds, and hence really shouldn't
assert on it.
This more or less reverts 415fc41ceaeada2e32639f24f134b1c248b9e43f.
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r-- | src/nspawn/nspawn.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 42355115ff..46d4edd4da 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -333,7 +333,10 @@ static int detect_unified_cgroup_hierarchy(const char *directory) { } /* Otherwise inherit the default from the host system */ - if (cg_all_unified()) { + r = cg_all_unified(); + if (r < 0) + return log_error_errno(r, "Failed to determine whether we are in all unified mode."); + if (r > 0) { /* Unified cgroup hierarchy support was added in 230. Unfortunately the detection * routine only detects 231, so we'll have a false negative here for 230. */ r = systemd_installation_has_version(directory, 230); @@ -343,7 +346,7 @@ static int detect_unified_cgroup_hierarchy(const char *directory) { arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL; else arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE; - } else if (cg_unified(SYSTEMD_CGROUP_CONTROLLER)) { + } else if (cg_unified(SYSTEMD_CGROUP_CONTROLLER) > 0) { /* Mixed cgroup hierarchy support was added in 233 */ r = systemd_installation_has_version(directory, 233); if (r < 0) |