chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2e6816c
)
cgroup-util: check unified_cache before invoking streq()
author
Lennart Poettering
<lennart@poettering.net>
Fri, 24 Feb 2017 14:53:17 +0000
(15:53 +0100)
committer
Sven Eden
<yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:36 +0000
(17:58 +0200)
Just a minor optimization.
src/basic/cgroup-util.c
patch
|
blob
|
history
diff --git
a/src/basic/cgroup-util.c
b/src/basic/cgroup-util.c
index 09c895804820bf0a3308df699592f9e556c5f18c..48c21a99b9707e8bd523a4a96ad55eaa710c5de3 100644
(file)
--- a/
src/basic/cgroup-util.c
+++ b/
src/basic/cgroup-util.c
@@
-2405,10
+2405,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) {