From b4cccbc13ad6f98bd8e816ce5fffb99f5be74c8c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Feb 2017 17:52:58 +0100 Subject: 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. --- src/core/manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/core/manager.c') diff --git a/src/core/manager.c b/src/core/manager.c index ea80585329..7a09ac1d6e 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -776,7 +776,10 @@ static int manager_setup_cgroups_agent(Manager *m) { if (!MANAGER_IS_SYSTEM(m)) return 0; - if (cg_unified(SYSTEMD_CGROUP_CONTROLLER)) /* We don't need this anymore on the unified hierarchy */ + r = cg_unified(SYSTEMD_CGROUP_CONTROLLER); + if (r < 0) + return log_error_errno(r, "Failed to determine whether unified cgroups hierarchy is used: %m"); + if (r > 0) /* We don't need this anymore on the unified hierarchy */ return 0; if (m->cgroups_agent_fd < 0) { -- cgit v1.2.3-54-g00ecf