X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=sidebyside;f=stat.c;h=3c72a6cd8a140b5fe0b81cb9d65d7dc1329a2dfb;hb=0e4a9bc81d0af7358f14a1c2a9bc3351f1b6a0b1;hp=74c2686c660ca33b76b12e85eefab3a68e933e7c;hpb=7903bf87725b18495a06f7199342f167147712eb;p=fio.git diff --git a/stat.c b/stat.c index 74c2686c..3c72a6cd 100644 --- a/stat.c +++ b/stat.c @@ -669,6 +669,8 @@ static void show_thread_status_normal(struct thread_stat *ts, if (!ddir_rw_sum(ts->io_bytes) && !ddir_rw_sum(ts->total_io_u)) return; + + memset(time_buf, 0, sizeof(time_buf)); time(&time_p); os_ctime_r((const time_t *) &time_p, time_buf, sizeof(time_buf)); @@ -1648,7 +1650,8 @@ void __show_run_stats(void) os_ctime_r((const time_t *) &now.tv_sec, time_buf, sizeof(time_buf)); - time_buf[strlen(time_buf) - 1] = '\0'; + if (time_buf[strlen(time_buf) - 1] == '\n') + time_buf[strlen(time_buf) - 1] = '\0'; root = json_create_object(); json_object_add_value_string(root, "fio version", fio_version_string);