2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

Introduce flush_early_log_to_stderr destructor

Prior log initialisation CRIU preserves all (early) log messages in a
buffer. In case of error the content of the content of this buffer
needs to be printed out (flushed).

Suggested-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
Radostin Stoyanov
2019-09-15 06:58:15 +01:00
committed by Andrei Vagin
parent 8bdc60d50e
commit a9f974b495

View File

@@ -47,6 +47,13 @@
#include "setproctitle.h"
#include "sysctl.h"
void flush_early_log_to_stderr() __attribute__((destructor));
void flush_early_log_to_stderr(void)
{
flush_early_log_buffer(STDERR_FILENO);
}
int main(int argc, char *argv[], char *envp[])
{
int ret = -1;
@@ -95,10 +102,8 @@ int main(int argc, char *argv[], char *envp[])
return cr_service_work(atoi(argv[2]));
}
if (check_options()) {
flush_early_log_buffer(STDERR_FILENO);
if (check_options())
return 1;
}
if (opts.imgs_dir == NULL)
SET_CHAR_OPTS(imgs_dir, ".");