]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
selinux: add unlikely compiler hints for cache functions
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 26 Mar 2020 19:15:08 +0000 (20:15 +0100)
committerChristian Göttsche <cgzones@googlemail.com>
Fri, 27 Mar 2020 19:54:58 +0000 (20:54 +0100)
src/basic/selinux-util.c

index 2d5e750ea56bf2d260ad9819bfff3305c8f418a3..0484ba0adb72760485dba75eab4bbff2bdcccbc8 100644 (file)
@@ -44,7 +44,7 @@ static struct selabel_handle *label_hnd = NULL;
 
 bool mac_selinux_use(void) {
 #if HAVE_SELINUX
-        if (cached_use < 0)
+        if (_unlikely_(cached_use < 0))
                 cached_use = is_selinux_enabled() > 0;
 
         return cached_use;
@@ -55,7 +55,7 @@ bool mac_selinux_use(void) {
 
 bool mac_selinux_enforcing(void) {
 #if HAVE_SELINUX
-        if (cached_enforcing < 0) {
+        if (_unlikely_(cached_enforcing < 0)) {
                 cached_enforcing = security_getenforce();
                 if (cached_enforcing == -1) {
                         log_error_errno(errno, "Failed to get SELinux enforced status: %m");