chiark / gitweb /
conf-parse: don't accept invalid bus names as BusName= arguments in service units
[elogind.git] / src / core / cgroup.c
index 3d5d8898b69bd323532277cb81d0d28103b739de..97f656eb5d8f4deaa850f4cd21cd6675bde4ec1c 100644 (file)
@@ -295,6 +295,9 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
         /* Some cgroup attributes are not support 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];