summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 94c7eea9b7..3a39b4a6f5 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -327,8 +327,12 @@ static int pick_cgroup_version(const char *directory, CGroupUnified outer) {
* the container doesn't have a new enough systemd (detected
* by checking libsystemd-shared). */
switch (outer) {
+ default:
+ case CGROUP_UNIFIED_INHERIT:
+ assert_not_reached("Invalid host cgroup version");
+ return -EINVAL;
case CGROUP_UNIFIED_UNKNOWN:
- assert_not_reached("Unknown host cgroup version");
+ arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_INHERIT;
break;
case CGROUP_UNIFIED_NONE: /* cgroup v1-sd */
arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE;
@@ -4058,6 +4062,9 @@ int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
cg_unified_flush();
+ r = cg_version(&outer_cgver);
+ if (r < 0)
+ outer_cgver = CGROUP_UNIFIED_UNKNOWN;
/* Make sure rename_process() in the stub init process can work */
saved_argv = argv;
@@ -4072,13 +4079,6 @@ int main(int argc, char *argv[]) {
r = -EPERM;
goto finish;
}
-
- r = cg_version(&outer_cgver);
- if (r < 0) {
- log_error_errno(r, "Failed to determine whether the unified cgroups hierarchy is used: %m");
- goto finish;
- }
-
r = determine_names();
if (r < 0)
goto finish;