Blob Blame History Raw
From: Quentin Monnet <quentin.monnet@netronome.com>
Date: Sat, 20 Oct 2018 23:01:49 +0100
Subject: tools: bpftool: print nb of cmds to stdout (not stderr) for batch
 mode
Patch-mainline: v4.20-rc1
Git-commit: 06ee9da6a8b49e0e12b7a825dbe6ad243d5463e2
References: bsc#1109837

When batch mode is used and all commands succeeds, bpftool prints the
number of commands processed to stderr. There is no particular reason to
use stderr for this, we could as well use stdout. It would avoid getting
unnecessary output on stderr if the standard ouptut is redirected, for
example.

Reported-by: David Beckett <david.beckett@netronome.com>
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 tools/bpf/bpftool/main.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -319,7 +319,8 @@ static int do_batch(int argc, char **arg
 		p_err("reading batch file failed: %s", strerror(errno));
 		err = -1;
 	} else {
-		p_info("processed %d commands", lines);
+		if (!json_output)
+			printf("processed %d commands\n", lines);
 		err = 0;
 	}
 err_close: