]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tools: bpftool: print nb of cmds to stdout (not stderr) for batch mode
authorQuentin Monnet <quentin.monnet@netronome.com>
Sat, 20 Oct 2018 22:01:49 +0000 (23:01 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Sun, 21 Oct 2018 18:45:14 +0000 (20:45 +0200)
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>
tools/bpf/bpftool/main.c

index 828dde30e9ecd17f5fb6df5312cc96356d7e3f4c..75a3296dc0bc8172117d87666cd85117c5560874 100644 (file)
@@ -321,7 +321,8 @@ static int do_batch(int argc, char **argv)
                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: