chiark / gitweb /
manager: simplify transaction_abort()
[elogind.git] / src / core / main.c
index 4c2be261f5130393be24cf8345ac729cdc2b1a7d..290de26022fc237c2e52a38e3a8ae6721054e9c9 100644 (file)
 
 #include "manager.h"
 #include "log.h"
-#include "mount-setup.h"
-#include "hostname-setup.h"
-#include "loopback-setup.h"
-#include "kmod-setup.h"
-#include "locale-setup.h"
-#include "selinux-setup.h"
-#include "ima-setup.h"
-#include "machine-id-util.h"
 #include "load-fragment.h"
 #include "fdset.h"
 #include "special.h"
 #include "virt.h"
 #include "watchdog.h"
 
+#include "mount-setup.h"
+#include "loopback-setup.h"
+#include "kmod-setup.h"
+#include "hostname-setup.h"
+#include "machine-id-setup.h"
+#include "locale-setup.h"
+#include "selinux-setup.h"
+#include "ima-setup.h"
+
 static enum {
         ACTION_RUN,
         ACTION_HELP,
@@ -1210,7 +1211,7 @@ int main(int argc, char *argv[]) {
 
         if (getpid() == 1) {
                 arg_running_as = MANAGER_SYSTEM;
-                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_JOURNAL_OR_KMSG);
+                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_JOURNAL : LOG_TARGET_JOURNAL_OR_KMSG);
 
                 if (!is_reexec) {
                         if (selinux_setup(&loaded_policy) < 0)
@@ -1221,7 +1222,7 @@ int main(int argc, char *argv[]) {
 
                 log_open();
 
-                if (label_init() < 0)
+                if (label_init(NULL) < 0)
                         goto finish;
 
                 if (!is_reexec)
@@ -1349,6 +1350,12 @@ int main(int argc, char *argv[]) {
                 unsetenv("SHLVL");
                 unsetenv("_");
 
+                /* When we are invoked by a tool chroot-like such as
+                 * nspawn, these might be set, but make little sense
+                 * to pass on */
+                unsetenv("USER");
+                unsetenv("LOGNAME");
+
                 /* All other variables are left as is, so that clients
                  * can still read them via /proc/1/environ */
         }