From 68f75bbd57b3b1fce7efa7b95c64d05f20eca28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 8 May 2021 03:35:17 +0200 Subject: [PATCH] tools/pw-dump: fix parentheses around `isatty()` call Previously, isatty(fileno(data.out) && getenv("NO_COLOR") == NULL)) would call `isatty()` with fileno(data.out) && getenv("NO_COLOR") == NULL as its argument. This meant that, for example, NO_COLOR=1 pw-dump would still produce colored output when run with a TTY as its standard input. Fix that by moving the parenthesis. Fixes: af63d084536f ("tools/pw-dump: only print colors if we're connected to a terminal") --- src/tools/pw-dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/pw-dump.c b/src/tools/pw-dump.c index 5f50e094d..c0ac81523 100644 --- a/src/tools/pw-dump.c +++ b/src/tools/pw-dump.c @@ -1429,7 +1429,7 @@ int main(int argc, char *argv[]) pw_init(&argc, &argv); data.out = stdout; - if (isatty(fileno(data.out) && getenv("NO_COLOR") == NULL)) + if (isatty(fileno(data.out)) && getenv("NO_COLOR") == NULL) colors = true; while ((c = getopt_long(argc, argv, "hVr:mN", long_options, NULL)) != -1) {