wur int config_security_is_enabled(void)
{
- int fd;
- int ret;
- char buf[128];
-
- /* CONFIG_SECURITY is disabled */
- if (access("/proc/self/attr/current", F_OK) != 0)
+ /* When SMACK is disabled this directory does not exist */
+ if (access("/sys/fs/smackfs", F_OK) != 0)
return 0;
- /*
- * Now only if read() fails with -EINVAL then we assume
- * that SECLABEL and LSM are disabled
- */
- fd = open("/proc/self/attr/current", O_RDONLY|O_CLOEXEC);
- if (fd < 0)
- return 1;
-
- ret = read(fd, buf, sizeof(buf));
- if (ret == -1 && errno == EINVAL)
- ret = 0;
- else
- ret = 1;
-
- CLOSE(fd);
-
- return ret;
+ return 1;
}