chiark / gitweb /
security: rework selinux, smack, ima, apparmor detection logic
[elogind.git] / src / shared / smack-util.c
index a73eaac6de26559cce83a56020e4104be8d1f497..4e8cf796d38ffcc0d6ecc456bc69e31b259d41f9 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "smack-util.h"
-
 #include <unistd.h>
 
-static int use_smack_cached = -1;
+#include "smack-util.h"
 
 bool use_smack(void) {
 
+#ifdef HAVE_SMACK
+        static int use_smack_cached = -1;
+
         if (use_smack_cached < 0)
-                use_smack_cached = (access("/sys/fs/smackfs", F_OK) >= 0);
+                use_smack_cached = access("/sys/fs/smackfs/", F_OK) >= 0;
 
         return use_smack_cached;
+#else
+        return false;
+#endif
+
 }