From c12e9a745dd08ec8944edcb7546e0393b50a9de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 7 Mar 2024 13:37:53 +0100 Subject: [PATCH] pw-top: only check terminal size in non-batch mode If ncurses is not initialized, then the global `LINES` variable stays 0. This will cause problems because there is an unconditional `if (y > LINES)` check when printing the driven nodes for a given driver node, resulting in only the first one being printed. Commit 71653e04d2ddb7 ("pw-top: add 'batch-mode' and iterations known from top") that introduced batch mode missed this one condition, so fix that by only checking the for terminal overflow in non-batch mode as it is done a couple lines above. Fixes #3899 --- src/tools/pw-top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/pw-top.c b/src/tools/pw-top.c index 80f162451..4df68a86b 100644 --- a/src/tools/pw-top.c +++ b/src/tools/pw-top.c @@ -577,7 +577,7 @@ static void do_refresh(struct data *d, bool force_refresh) continue; print_node(d, &n->info, f, y++); - if(y > LINES) + if(!d->batch_mode && y > LINES) break; }