log: make the logging functions handle > 1024 bytes correctly
authorJens Axboe <axboe@fb.com>
Wed, 24 May 2017 03:45:31 +0000 (21:45 -0600)
committerJens Axboe <axboe@fb.com>
Wed, 24 May 2017 03:45:31 +0000 (21:45 -0600)
commit7d64aa48fcfc03a93ea1623338a760e66406b132
tree23e14d938dd6ade90ad1703704f4e946e7b940ce
parentc8a07f8778322dda82ca1d87f357be4a41bc0296
log: make the logging functions handle > 1024 bytes correctly

We simply truncate the output if it's larger than our static
buffer. Make it dynamically allocated instead, and ensure that
we loop correctly to handle the full amount asked for.

This fixes a problem with truncated output. One example is
json output, with file names (for multiple files) that are
larger than 1024 bytes. With the truncated output, we would
truncate the file name and hence also miss the terminating
'"'. The latter means the json was no longer valid, either.

Signed-off-by: Jens Axboe <axboe@fb.com>
log.c