chiark / gitweb /
cgroup-util: fix the case of default=unified, unified-cgroup-hierarchy=0
[elogind.git] / src / basic / cgroup-util.c
index f5b2fe6b6ece63fbcfa8b13f9a2e0b68ed0d0279..09c895804820bf0a3308df699592f9e556c5f18c 100644 (file)
@@ -2513,7 +2513,10 @@ bool cg_is_hybrid_wanted(void) {
         static thread_local int wanted = -1;
         int r;
         bool b;
-        const bool is_default = DEFAULT_HIERARCHY == CGROUP_UNIFIED_SYSTEMD;
+        const bool is_default = DEFAULT_HIERARCHY >= CGROUP_UNIFIED_SYSTEMD;
+        /* We default to true if the default is "hybrid", obviously,
+         * but also when the default is "unified", because if we get
+         * called, it means that unified hierarchy was not mounted. */
 
         /* If we have a cached value, return that. */
         if (wanted >= 0)