X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmain.c;h=b181447ca33b61a537e2ea4a3b9b938fe1625538;hb=6c7506dca32f8add56cd03bf263f417305de74a0;hp=045203383de7c55960b07ba158bb33f66ea98472;hpb=2076cf883110bd6fc0f87b619005baf2117d6b95;p=elogind.git diff --git a/src/main.c b/src/main.c index 045203383..b181447ca 100644 --- a/src/main.c +++ b/src/main.c @@ -898,6 +898,9 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) { assert(_f); assert(_fds); + /* Make sure nothing is really destructed when we shut down */ + m->n_reloading ++; + if ((r = manager_open_serialization(m, &f)) < 0) { log_error("Failed to create serialization file: %s", strerror(-r)); goto fail; @@ -988,7 +991,7 @@ static void test_usr(void) { if (dir_is_empty("/usr") <= 0) return; - log_warning("/usr appears to be on a different file system than /. This is not supported anymore. " + log_warning("/usr appears to be on its own filesytem and is not already mounted. This is not a supported setup. " "Some things will probably break (sometimes even silently) in mysterious ways. " "Consult http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken for more information."); } @@ -1033,6 +1036,8 @@ int main(int argc, char *argv[]) { program_invocation_short_name = systemd; prctl(PR_SET_NAME, systemd); + saved_argv = argv; + saved_argc = argc; log_show_color(isatty(STDERR_FILENO) > 0); log_show_location(false); @@ -1041,6 +1046,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_SYSLOG_OR_KMSG); + log_open(); /* This might actually not return, but cause a * reexecution */ @@ -1051,17 +1057,19 @@ int main(int argc, char *argv[]) { goto finish; if (hwclock_is_localtime() > 0) { - int min; + int err, min; - min = hwclock_apply_localtime_delta(); - if (min < 0) - log_error("Failed to apply local time delta: %s", strerror(-min)); + err = hwclock_apply_localtime_delta(&min); + if (err < 0) + log_error("Failed to apply local time delta: %s", strerror(-err)); else log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min); } + } else { arg_running_as = MANAGER_USER; - log_set_target(LOG_TARGET_CONSOLE); + log_set_target(LOG_TARGET_AUTO); + log_open(); } if (set_default_unit(SPECIAL_DEFAULT_TARGET) < 0) @@ -1117,6 +1125,9 @@ int main(int argc, char *argv[]) { assert_se(arg_action == ACTION_RUN || arg_action == ACTION_TEST); + /* Close logging fds, in order not to confuse fdset below */ + log_close(); + /* Remember open file descriptors for later deserialization */ if (serialization) { if ((r = fdset_new_fill(&fds)) < 0) {