c2dfb7
From 7301b170b266225f091e95ff52b3a95ff9776d13 Mon Sep 17 00:00:00 2001
c2dfb7
From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= <msekleta@redhat.com>
c2dfb7
Date: Fri, 3 Apr 2020 09:13:59 +0200
c2dfb7
Subject: [PATCH] selinux: do preprocessor check only in selinux-access.c
c2dfb7
c2dfb7
This has the advantage that mac_selinux_access_check() can be used as a
c2dfb7
function in all contexts. For example, parameters passed to it won't be
c2dfb7
reported as unused if the "function" call is replaced with 0 on SELinux
c2dfb7
disabled builds.
c2dfb7
c2dfb7
(cherry picked from commit 08deac6e3e9119aeb966375f94695e4aa14ffb1c)
c2dfb7
c2dfb7
Related: #1830861
c2dfb7
---
c2dfb7
 src/core/selinux-access.h | 9 ---------
c2dfb7
 1 file changed, 9 deletions(-)
c2dfb7
c2dfb7
diff --git a/src/core/selinux-access.h b/src/core/selinux-access.h
c2dfb7
index 59f2e60c77..46a657a4b4 100644
c2dfb7
--- a/src/core/selinux-access.h
c2dfb7
+++ b/src/core/selinux-access.h
c2dfb7
@@ -12,17 +12,8 @@
c2dfb7
 
c2dfb7
 int mac_selinux_generic_access_check(sd_bus_message *message, const char *path, const char *permission, sd_bus_error *error);
c2dfb7
 
c2dfb7
-#if HAVE_SELINUX
c2dfb7
-
c2dfb7
 #define mac_selinux_access_check(message, permission, error) \
c2dfb7
         mac_selinux_generic_access_check((message), NULL, (permission), (error))
c2dfb7
 
c2dfb7
 #define mac_selinux_unit_access_check(unit, message, permission, error) \
c2dfb7
         mac_selinux_generic_access_check((message), unit_label_path(unit), (permission), (error))
c2dfb7
-
c2dfb7
-#else
c2dfb7
-
c2dfb7
-#define mac_selinux_access_check(message, permission, error) 0
c2dfb7
-#define mac_selinux_unit_access_check(unit, message, permission, error) 0
c2dfb7
-
c2dfb7
-#endif