chiark / gitweb /
selinux: close stdin/stdout/stderr before loading selinux policy
authorLennart Poettering <lennart@poettering.net>
Mon, 10 Sep 2012 11:14:56 +0000 (13:14 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 10 Sep 2012 11:14:56 +0000 (13:14 +0200)
Let's make sure libselinux doesn't spew to stderr

src/core/main.c
src/core/selinux-setup.c

index 33c0692c712cbdc71f7fb2b07b69cea560b4a455..458fdca55e86f9b465ef8bd6347b95067fdb19ee 100644 (file)
@@ -1266,6 +1266,8 @@ int main(int argc, char *argv[]) {
                 }
 
                 arg_running_as = MANAGER_SYSTEM;
+
+                make_null_stdio();
                 log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_JOURNAL : LOG_TARGET_JOURNAL_OR_KMSG);
 
                 if (!skip_setup) {
@@ -1439,10 +1441,8 @@ int main(int argc, char *argv[]) {
 
         /* Reset the console, but only if this is really init and we
          * are freshly booted */
-        if (arg_running_as == MANAGER_SYSTEM && arg_action == ACTION_RUN) {
+        if (arg_running_as == MANAGER_SYSTEM && arg_action == ACTION_RUN)
                 console_setup(getpid() == 1 && !skip_setup);
-                make_null_stdio();
-        }
 
         /* Open the logging devices, if possible and necessary */
         log_open();
index fa025b72687ad0d4e0863a3589a610f20b05e6d2..52df7a7221f98c54256589ff45feedf87c63bc2e 100644 (file)
@@ -79,7 +79,6 @@ int selinux_setup(bool *loaded_policy) {
        /* Now load the policy */
        before_load = now(CLOCK_MONOTONIC);
        r = selinux_init_load_policy(&enforce);
-
        if (r == 0) {
                char timespan[FORMAT_TIMESPAN_MAX];
                char *label;