hib-res-generator: open logging before emitting the first message

Also add a debug message when we are not in initrd, because it can be
confusing why nothing is happenning.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-09-26 07:23:03 +02:00
parent 0307ea49c7
commit a79858bfd1
1 changed files with 10 additions and 8 deletions

View File

@ -60,6 +60,13 @@ static int process_resume(void) {
int main(int argc, char *argv[]) {
int r = 0;
log_set_prohibit_ipc(true);
log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
umask(0022);
if (argc > 1 && argc != 4) {
log_error("This program takes three or no arguments.");
return EXIT_FAILURE;
@ -68,16 +75,11 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[1];
log_set_prohibit_ipc(true);
log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
umask(0022);
/* Don't even consider resuming outside of initramfs. */
if (!in_initrd())
if (!in_initrd()) {
log_debug("Not running in an initrd, quitting.");
return EXIT_SUCCESS;
}
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
if (r < 0)