In some cases where we could not send a single message, loggen tried to divide by zero shortly before printing the statistics at the end. This was trivially reproducible by using -R with a file that contained invalid syslog lines. Signed-off-by: Gergely Nagy <algernon@balabit.hu> --- tests/loggen/loggen.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/tests/loggen/loggen.c b/tests/loggen/loggen.c index bf5d111..c5399a7 100644 --- a/tests/loggen/loggen.c +++ b/tests/loggen/loggen.c @@ -467,7 +467,12 @@ gen_messages(send_data_t send_func, void *send_func_ud, int thread_id, FILE *rea printf("%d;%lu.%06lu;%.2lf;%lu\n", thread_id, (long) diff_tv.tv_sec, (long) diff_tv.tv_usec, (((double) (count - last_count) * USEC_PER_SEC) / diff_usec), count); if (readfrom) - raw_message_length = sum_linelen/count; + { + if (count) + raw_message_length = sum_linelen/count; + else + raw_message_length = 0; + } free(testsdata); return count; } -- 1.7.2.5