1 Purpose: Try to fix the logic used to enable SELinux
2 Authour: Petter Reinholdtsen
4 Status: applied upstream
11 # include <selinux/selinux.h>
12 -# include <sys/mount.h>
13 -# ifndef MNT_DETACH /* present in glibc 2.10, missing in 2.7 */
14 -# define MNT_DETACH 2
19 @@ -2872,11 +2868,9 @@ int main(int argc, char **argv)
22 if (getenv("SELINUX_INIT") == NULL) {
23 - const int rc = mount("proc", "/proc", "proc", 0, 0);
24 - if (is_selinux_enabled() > 0) {
25 - putenv("SELINUX_INIT=YES");
26 - if (rc == 0) umount2("/proc", MNT_DETACH);
27 + if (is_selinux_enabled() != 1) {
28 if (selinux_init_load_policy(&enforce) == 0) {
29 + putenv("SELINUX_INIT=YES");
33 @@ -2887,7 +2881,6 @@ int main(int argc, char **argv)
37 - if (rc == 0) umount2("/proc", MNT_DETACH);