chiark / gitweb /
Use format patterns for usec_t, pid_t, nsec_t, usec_t
[elogind.git] / src / core / main.c
index e00d0702fe2892dbe47ae84ef0cf22d00a3ff341..d052c8debc79ce281530ee7ce151b563fa870c11 100644 (file)
@@ -166,7 +166,7 @@ noreturn static void crash(int sig) {
                         else if (status.si_code != CLD_DUMPED)
                                 log_error("Caught <%s>, core dump failed.", signal_to_string(sig));
                         else
-                                log_error("Caught <%s>, dumped core as pid %lu.", signal_to_string(sig), (unsigned long) pid);
+                                log_error("Caught <%s>, dumped core as pid "PID_FMT".", signal_to_string(sig), pid);
                 }
         }
 
@@ -197,7 +197,7 @@ noreturn static void crash(int sig) {
                         _exit(1);
                 }
 
-                log_info("Successfully spawned crash shell as pid %lu.", (unsigned long) pid);
+                log_info("Successfully spawned crash shell as pid "PID_FMT".", pid);
         }
 
         log_info("Freezing execution.");
@@ -417,7 +417,7 @@ static int parse_proc_cmdline_word(const char *word) {
                  * will block with every log message for for 60 seconds,
                  * before they give up. */
                 log_set_max_level(LOG_DEBUG);
-                log_set_target(LOG_TARGET_KMSG);
+                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG);
         } else if (!in_initrd()) {
                 unsigned i;
 
@@ -462,7 +462,6 @@ DEFINE_SETTER(config_parse_target, log_set_target_from_string, "target")
 DEFINE_SETTER(config_parse_color, log_show_color_from_string, "color" )
 DEFINE_SETTER(config_parse_location, log_show_location_from_string, "location")
 
-
 static int config_parse_cpu_affinity2(const char *unit,
                                       const char *filename,
                                       unsigned line,
@@ -1489,7 +1488,8 @@ int main(int argc, char *argv[]) {
                         status_welcome();
 
 #ifdef HAVE_KMOD
-                kmod_setup();
+                if (detect_container(NULL) <= 0)
+                        kmod_setup();
 #endif
                 hostname_setup();
                 machine_id_setup();
@@ -1865,7 +1865,7 @@ finish:
                         watchdog_close(false);
 
                         /* Tell the binary how often to ping */
-                        snprintf(e, sizeof(e), "WATCHDOG_USEC=%llu", (unsigned long long) arg_shutdown_watchdog);
+                        snprintf(e, sizeof(e), "WATCHDOG_USEC="USEC_FMT, arg_shutdown_watchdog);
                         char_array_0(e);
 
                         env_block = strv_append(environ, e);