Commit 49dc94ad authored by Saied Kazemi's avatar Saied Kazemi Committed by Pavel Emelyanov

Need bigger log buffer to avoid message truncation

The help message of CRIU has grown in size and is truncated because the
size of the private buffer in log.c is too small.  This patch increases
the size of the buffer.

[ The "bad" message is the --help output one ]
Signed-off-by: 's avatarSaied Kazemi <saied@google.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1fff98f7
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
static unsigned int current_loglevel = DEFAULT_LOGLEVEL; static unsigned int current_loglevel = DEFAULT_LOGLEVEL;
static char buffer[PAGE_SIZE]; static char buffer[PAGE_SIZE * 2];
static char buf_off = 0; static char buf_off = 0;
static struct timeval start; static struct timeval start;
...@@ -123,7 +123,7 @@ int log_init_by_pid(void) ...@@ -123,7 +123,7 @@ int log_init_by_pid(void)
reset_buf_off(); reset_buf_off();
if (!opts.log_file_per_pid) { if (!opts.log_file_per_pid) {
buf_off += snprintf(buffer + buf_off, PAGE_SIZE - buf_off, "%6d: ", getpid()); buf_off += snprintf(buffer + buf_off, sizeof buffer - buf_off, "%6d: ", getpid());
return 0; return 0;
} }
...@@ -169,7 +169,7 @@ static void __print_on_level(unsigned int loglevel, const char *format, va_list ...@@ -169,7 +169,7 @@ static void __print_on_level(unsigned int loglevel, const char *format, va_list
print_ts(); print_ts();
} }
size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params); size = vsnprintf(buffer + buf_off, sizeof buffer - buf_off, format, params);
size += buf_off; size += buf_off;
while (off < size) { while (off < size) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment