#include #include #include #include #include #include #include "selinux_internal.h" #include "policy.h" #include #include int security_get_checkreqprot(void) { int fd, ret, checkreqprot = 0; char path[PATH_MAX]; char buf[20]; if (!selinux_mnt) { errno = ENOENT; return -1; } snprintf(path, sizeof(path), "%s/checkreqprot", selinux_mnt); fd = open(path, O_RDONLY | O_CLOEXEC); if (fd < 0) return -1; memset(buf, 0, sizeof(buf)); ret = read(fd, buf, sizeof(buf) - 1); close(fd); if (ret < 0) return -1; if (sscanf(buf, "%d", &checkreqprot) != 1) return -1; return checkreqprot; }