* Fix some minor problems

* init - enable is_selinux_enabled() to detect selinuxfs
This commit is contained in:
Werner Fink 2010-03-19 16:53:57 +00:00
parent 2950c304a1
commit 210e6a26a6
5 changed files with 28 additions and 11 deletions

View File

@ -18,6 +18,8 @@
* init - add the possiblity to ignore further interrupts from keyboard * init - add the possiblity to ignore further interrupts from keyboard
* init - add the possiblity to set sane terminal line settings * init - add the possiblity to set sane terminal line settings
* sulogin - add the possibility to reset the terminal io * sulogin - add the possibility to reset the terminal io
* Fix some minor problems
* init - enable is_selinux_enabled() to detect selinuxfs
sysvinit (2.88dsf) UNRELEASED; urgency=low sysvinit (2.88dsf) UNRELEASED; urgency=low

View File

@ -51,7 +51,11 @@ static sigjmp_buf jbuf;
* Alarm handler * Alarm handler
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
# ifdef __GNUC__
static void handler(int arg __attribute__((unused)))
# else
static void handler(int arg) static void handler(int arg)
# endif
{ {
siglongjmp(jbuf, 1); siglongjmp(jbuf, 1);
} }

View File

@ -54,6 +54,7 @@
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <sys/mount.h>
#endif #endif
@ -2839,18 +2840,23 @@ int main(int argc, char **argv)
} }
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
if (getenv("SELINUX_INIT") == NULL && !is_selinux_enabled()) { if (getenv("SELINUX_INIT") == NULL) {
putenv("SELINUX_INIT=YES"); const int rc = mount("proc", "/proc", "proc", 0, 0);
if (selinux_init_load_policy(&enforce) == 0 ) { if (is_selinux_enabled() > 0) {
execv(myname, argv); putenv("SELINUX_INIT=YES");
} else { if (rc == 0) umount2("/proc", MNT_DETACH);
if (enforce > 0) { if (selinux_init_load_policy(&enforce) == 0) {
/* SELinux in enforcing mode but load_policy failed */ execv(myname, argv);
/* At this point, we probably can't open /dev/console, so log() won't work */ } else {
fprintf(stderr,"Unable to load SELinux Policy. Machine is in enforcing mode. Halting now.\n"); if (enforce > 0) {
exit(1); /* SELinux in enforcing mode but load_policy failed */
/* At this point, we probably can't open /dev/console, so log() won't work */
fprintf(stderr,"Unable to load SELinux Policy. Machine is in enforcing mode. Halting now.\n");
exit(1);
}
} }
} }
if (rc == 0) umount2("/proc", MNT_DETACH);
} }
#endif #endif
/* Start booting. */ /* Start booting. */

View File

@ -95,7 +95,12 @@ void hardsleep(int secs)
/* /*
* Break off an already running shutdown. * Break off an already running shutdown.
*/ */
# ifdef __GNUC__
void stopit(int sig __attribute__((unused)))
# else
void stopit(int sig) void stopit(int sig)
# endif
{ {
unlink(NOLOGIN); unlink(NOLOGIN);
unlink(FASTBOOT); unlink(FASTBOOT);

View File

@ -403,7 +403,7 @@ void sushell(struct passwd *pwd)
signal(SIGTSTP, saved_sigtstp); signal(SIGTSTP, saved_sigtstp);
signal(SIGQUIT, saved_sigquit); signal(SIGQUIT, saved_sigquit);
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
if (is_selinux_enabled > 0) { if (is_selinux_enabled() > 0) {
security_context_t scon=NULL; security_context_t scon=NULL;
char *seuser=NULL; char *seuser=NULL;
char *level=NULL; char *level=NULL;