diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 20f9cd679534..27e805943443 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -4272,13 +4272,17 @@ print_iostat_header(iostat_cbdata_t *cb) * by order of magnitude. Uses column_size to add padding. */ static void -print_stat_color(char *statbuf, unsigned int column_size) +print_stat_color(const char *statbuf, unsigned int column_size) { fputs(" ", stdout); + size_t len = strlen(statbuf); + while (len < column_size) { + fputc(' ', stdout); + column_size--; + } if (*statbuf == '0') { color_start(ANSI_GRAY); fputc('0', stdout); - column_size--; } else { for (; *statbuf; statbuf++) { if (*statbuf == 'K') color_start(ANSI_GREEN); @@ -4293,8 +4297,6 @@ print_stat_color(char *statbuf, unsigned int column_size) } } color_end(); - for (; column_size > 0; column_size--) - fputc(' ', stdout); } /*