X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fcgroup.c;h=10fdcc9984e39f4a5171c77d68c750d7b7d3d490;hb=c43b2132f37264600cc26e07c8d85dfdd6c969f0;hp=3d5d8898b69bd323532277cb81d0d28103b739de;hpb=714e2e1d56b97dcf2ebae2d0447b48f21e38a600;p=elogind.git diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 3d5d8898b..10fdcc998 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -292,9 +292,12 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha if (mask == 0) return; - /* Some cgroup attributes are not support on the root cgroup, + /* Some cgroup attributes are not supported on the root cgroup, * hence silently ignore */ is_root = isempty(path) || path_equal(path, "/"); + if (is_root) + /* Make sure we don't try to display messages with an empty path. */ + path = "/"; /* We generally ignore errors caused by read-only mounted * cgroup trees (assuming we are running in a container then), @@ -377,7 +380,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha } } - if (mask & CGROUP_MEMORY) { + if ((mask & CGROUP_MEMORY) && !is_root) { if (c->memory_limit != (uint64_t) -1) { char buf[DECIMAL_STR_MAX(uint64_t) + 1]; @@ -951,7 +954,7 @@ int manager_setup_cgroup(Manager *m) { if (m->pin_cgroupfs_fd < 0) return log_error_errno(errno, "Failed to open pin file: %m"); - /* 6. Always enable hierarchial support if it exists... */ + /* 6. Always enable hierarchical support if it exists... */ cg_set_attribute("memory", "/", "memory.use_hierarchy", "1"); }