Merge branch 'eta_overflow' of https://github.com/sitsofe/fio
authorJens Axboe <axboe@kernel.dk>
Thu, 21 Dec 2017 15:22:39 +0000 (08:22 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 21 Dec 2017 15:22:39 +0000 (08:22 -0700)
eta.c

diff --git a/eta.c b/eta.c
index 8b77dafaf9700b30996c1650788ec6c554598cdf..087f57d965a015e171cd4478a2da4c5bdb5bdc4c 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -585,7 +585,7 @@ void display_thread_status(struct jobs_eta *je)
                        iops_str[ddir] = num2str(je->iops[ddir], 4, 1, 0, N2S_NONE);
                }
 
-               left = sizeof(output) - (p - output) - 1;
+               left = sizeof(output) - (p - output) - 2;
 
                if (je->rate[DDIR_TRIM] || je->iops[DDIR_TRIM])
                        l = snprintf(p, left,
@@ -601,6 +601,8 @@ void display_thread_status(struct jobs_eta *je)
                                rate_str[DDIR_READ], rate_str[DDIR_WRITE],
                                iops_str[DDIR_READ], iops_str[DDIR_WRITE],
                                eta_str);
+               if (l > left)
+                       l = left;
                p += l;
                if (l >= 0 && l < linelen_last)
                        p += sprintf(p, "%*s", linelen_last - l, "");