mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +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:
committed by
Andrei Vagin
parent
8bdc60d50e
commit
a9f974b495
@@ -47,6 +47,13 @@
|
|||||||
#include "setproctitle.h"
|
#include "setproctitle.h"
|
||||||
#include "sysctl.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 main(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@@ -95,10 +102,8 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
return cr_service_work(atoi(argv[2]));
|
return cr_service_work(atoi(argv[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_options()) {
|
if (check_options())
|
||||||
flush_early_log_buffer(STDERR_FILENO);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (opts.imgs_dir == NULL)
|
if (opts.imgs_dir == NULL)
|
||||||
SET_CHAR_OPTS(imgs_dir, ".");
|
SET_CHAR_OPTS(imgs_dir, ".");
|
||||||
|
Reference in New Issue
Block a user