* Fix some minor problems
authorDr. Werner Fink <werner@suse.de>
Fri, 19 Mar 2010 16:53:57 +0000 (16:53 +0000)
committerDr. Werner Fink <werner@suse.de>
Fri, 19 Mar 2010 16:53:57 +0000 (16:53 +0000)
  * init - enable is_selinux_enabled() to detect selinuxfs

git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@44 456724a4-4300-0410-8514-c89748c515a2

doc/Changelog
src/dowall.c
src/init.c
src/shutdown.c
src/sulogin.c

index d767f3073450f941c175bc3ec48a60bb03d4180f..9a61b01cefd3a62f4634da82ec266ee816014971 100644 (file)
@@ -18,6 +18,8 @@
   * init - add the possiblity to ignore further interrupts from keyboard
   * init - add the possiblity to set sane terminal line settings
   * 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
 
index 826c59c19bd0662040fa6ca4cbe35bd668de583b..85645c032e6335461a142249626ba661aad844a1 100644 (file)
@@ -51,7 +51,11 @@ static sigjmp_buf jbuf;
  *     Alarm handler
  */
 /*ARGSUSED*/
+# ifdef __GNUC__
+static void handler(int arg __attribute__((unused)))
+# else
 static void handler(int arg)
+# endif
 {
        siglongjmp(jbuf, 1);
 }
index 6ed22e095aea182d17a45726681c1bc95529f9d2..feeeeaa0d8268f08747d40c0963a31a10680b926 100644 (file)
@@ -54,6 +54,7 @@
 
 #ifdef WITH_SELINUX
 #include <selinux/selinux.h>
+#include <sys/mount.h>
 #endif
 
 
@@ -2839,18 +2840,23 @@ int main(int argc, char **argv)
        }
 
 #ifdef WITH_SELINUX
-       if (getenv("SELINUX_INIT") == NULL && !is_selinux_enabled()) {
-         putenv("SELINUX_INIT=YES");
-         if (selinux_init_load_policy(&enforce) == 0 ) {
-           execv(myname, argv);
-         } else {
-           if (enforce > 0) {
-             /* 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 (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 (selinux_init_load_policy(&enforce) == 0) {
+             execv(myname, argv);
+           } else {
+             if (enforce > 0) {
+               /* 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  
        /* Start booting. */
index 24a1a45f724755aad12e300cfdcac1836ea6f419..397dcf5c03ec859b695721e83bfbdd1c6fdf60ba 100644 (file)
@@ -95,7 +95,12 @@ void hardsleep(int secs)
 /*
  *     Break off an already running shutdown.
  */
+# ifdef __GNUC__
+void stopit(int sig __attribute__((unused)))
+# else
 void stopit(int sig)
+# endif
+
 {
        unlink(NOLOGIN);
        unlink(FASTBOOT);
index 8c121a457533473cfa4ffd409cd8beaa7ab3d432..1eded6a8f89c931e1e71ac9ae69b1ea93dce10ee 100644 (file)
@@ -403,7 +403,7 @@ void sushell(struct passwd *pwd)
        signal(SIGTSTP, saved_sigtstp);
        signal(SIGQUIT, saved_sigquit);
 #ifdef WITH_SELINUX
-       if (is_selinux_enabled > 0) {
+       if (is_selinux_enabled() > 0) {
          security_context_t scon=NULL;
          char *seuser=NULL;
          char *level=NULL;