This is to allow for the header (16bytes and variable length function).
so if someone has a function name > 400 chars it will break. I
recon that will do:)
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/log_blackbox.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/log_blackbox.c b/lib/log_blackbox.c
index 7f15e56..16666ca 100644
--- a/lib/log_blackbox.c
+++ b/lib/log_blackbox.c
@@ -142,7 +142,8 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
{
qb_ringbuffer_t *instance;
ssize_t bytes_read;
- char chunk[512];
+ int max_size = 2 * QB_LOG_MAX_LEN;
+ char *chunk;
int fd;
char time_buf[64];
@@ -156,6 +157,7 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
if (instance == NULL) {
return;
}
+ chunk = malloc(max_size);
do {
char *ptr;
@@ -167,7 +169,7 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
char message[QB_LOG_MAX_LEN];
uint32_t u32;
- bytes_read = qb_rb_chunk_read(instance, chunk, 512, 0);
+ bytes_read = qb_rb_chunk_read(instance, chunk, max_size, 0);
ptr = chunk;
if (bytes_read > 0) {
struct tm *tm;
@@ -207,4 +209,5 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
}
} while (bytes_read > 0);
qb_rb_close(instance);
+ free(chunk);
}
--
1.7.10.2