#include "lib/pow2.h"
static char __run_str[REAL_MAX_JOBS + 1];
-static char run_str[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS)];
+static char run_str[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS) + 1];
static void update_condensed_str(char *rstr, char *run_str_condensed)
{
iops_str[ddir] = num2str(je->iops[ddir], 4, 1, 0, N2S_NONE);
}
- left = sizeof(output) - (p - output) - 2;
+ left = sizeof(output) - (p - output) - 1;
if (je->rate[DDIR_TRIM] || je->iops[DDIR_TRIM])
l = snprintf(p, left,
rate_str[DDIR_READ], rate_str[DDIR_WRITE],
iops_str[DDIR_READ], iops_str[DDIR_WRITE],
eta_str);
- if (l > left)
- l = left;
+ /* If truncation occurred adjust l so p is on the null */
+ if (l >= left)
+ l = left - 1;
p += l;
if (l >= 0 && l < linelen_last)
p += sprintf(p, "%*s", linelen_last - l, "");