summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-24 15:53:17 +0100
committerLennart Poettering <lennart@poettering.net>2017-02-24 15:53:19 +0100
commitfc9ae7178e1462377b272a14b1a763d480ab0980 (patch)
treee985a8010717952668628396141d10a46adc0f15
parentecc0eab247da25a6767ccabd2162a4d03de6ee8c (diff)
cgroup-util: check unified_cache before invoking streq()
Just a minor optimization.
-rw-r--r--src/basic/cgroup-util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index f76b7f47e5..7ed614670d 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -2340,10 +2340,13 @@ bool cg_unified(const char *controller) {
assert(cg_update_unified() >= 0);
- if (streq_ptr(controller, SYSTEMD_CGROUP_CONTROLLER))
- return unified_cache >= CGROUP_UNIFIED_SYSTEMD;
- else
- return unified_cache >= CGROUP_UNIFIED_ALL;
+ if (unified_cache == CGROUP_UNIFIED_NONE)
+ return false;
+
+ if (unified_cache >= CGROUP_UNIFIED_ALL)
+ return true;
+
+ return streq_ptr(controller, SYSTEMD_CGROUP_CONTROLLER);
}
bool cg_all_unified(void) {