From 51145001873b1cee5bc14dde965a6d391fc14baa Mon Sep 17 00:00:00 2001 From: Werner Fink Date: Mon, 17 May 2010 09:44:34 +0000 Subject: [PATCH] Add fix for Debian bug #580272 --- doc/Changelog | 4 ++++ src/init.c | 11 ++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 9b1ed59..0687e09 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -7,6 +7,10 @@ sysvinit (2.89dsf) UNRELEASED; urgency=low * Include limits.h in killall.c to enforce definition of PATH_MAX * Fix sysvinit bug #29758 Linker invocation should not contain headers. Change based on patch from Elias Pipping. + * Add fix for Debian bug #580272: use return value 1 of + is_selinux_enabled() to determine if SELinux is enabled, + otherwise initialize SELinux and load the policy. Patch from + Petter Reinholdtsen. [ Petter Reinholdtsen ] * Next release will be 2.89dsf. diff --git a/src/init.c b/src/init.c index 3d7de76..7d3827c 100644 --- a/src/init.c +++ b/src/init.c @@ -54,10 +54,6 @@ #ifdef WITH_SELINUX # include -# include -# ifndef MNT_DETACH /* present in glibc 2.10, missing in 2.7 */ -# define MNT_DETACH 2 -# endif #endif #ifdef __i386__ @@ -2872,11 +2868,9 @@ int main(int argc, char **argv) #ifdef WITH_SELINUX if (getenv("SELINUX_INIT") == NULL) { - const int rc = mount("proc", "/proc", "proc", 0, 0); - if (is_selinux_enabled() > 0) { - putenv("SELINUX_INIT=YES"); - if (rc == 0) umount2("/proc", MNT_DETACH); + if (is_selinux_enabled() != 1) { if (selinux_init_load_policy(&enforce) == 0) { + putenv("SELINUX_INIT=YES"); execv(myname, argv); } else { if (enforce > 0) { @@ -2887,7 +2881,6 @@ int main(int argc, char **argv) } } } - if (rc == 0) umount2("/proc", MNT_DETACH); } #endif /* Start booting. */