[CRIU] [PATCH] Need bigger log buffer to avoid message truncation

Saied Kazemi saied at google.com
Tue Jul 7 07:35:09 PDT 2015


Sorry it wasn't clear in the commit log.  Try criu --help and you will
see it's truncated.

$ ./criu  --version
Version: 1.6
$ ./criu --help
...
  -d|--daemon           run in the background after creating s$

--Saied


On Tue, Jul 7, 2015 at 2:38 AM, Andrew Vagin <avagin at odin.com> wrote:
> On Mon, Jul 06, 2015 at 03:42:08PM -0700, Saied Kazemi wrote:
>> 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.
>
> This buffer is intended for one message. One message is one line in a
> log file. Where do we print so big messages?
>
>>
>> Signed-off-by: Saied Kazemi <saied at google.com>
>> ---
>>  log.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/log.c b/log.c
>> index 3456daf..448f854 100644
>> --- a/log.c
>> +++ b/log.c
>> @@ -25,7 +25,7 @@
>>
>>  static unsigned int current_loglevel = DEFAULT_LOGLEVEL;
>>
>> -static char buffer[PAGE_SIZE];
>> +static char buffer[PAGE_SIZE * 2];
>>  static char buf_off = 0;
>>
>>  static struct timeval start;
>> @@ -123,7 +123,7 @@ int log_init_by_pid(void)
>>       reset_buf_off();
>>
>>       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;
>>       }
>>
>> @@ -169,7 +169,7 @@ static void __print_on_level(unsigned int loglevel, const char *format, va_list
>>                       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;
>>
>>       while (off < size) {
>> --
>> 2.4.3.573.g4eafbef
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list