Fix "Add colored output to zfs list"

Running `zfs list -o avail rpool` resulted in a core dump.
This commit will fix this.

Run the needed overhead only, when `use_color()` is true.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <gwilson@delphix.com>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #14712
This commit is contained in:
Tino Reichardt
2023-04-05 18:57:01 +02:00
committed by GitHub
parent 3399a30ee0
commit 6ecdd35bdb
4 changed files with 21 additions and 3 deletions
+1 -1
View File
@@ -1965,7 +1965,7 @@ zfs_version_print(void)
* Return 1 if the user requested ANSI color output, and our terminal supports
* it. Return 0 for no color.
*/
static int
int
use_color(void)
{
static int use_color = -1;