tools: bpftool: preserve JSON output on errors on batch file parsing

Before this patch, perror() function is used in some cases when bpftool
fails to parse its input file in batch mode. This function does not
integrate well with the rest of the output when JSON is used, so we
replace it by something that is compliant.

Most calls to perror() had already been replaced in a previous patch,
this one is a leftover.

Fixes: d319c8e101c5 ("tools: bpftool: preserve JSON output on errors on batch file parsing")
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
Quentin Monnet 2018-02-14 22:42:55 -08:00 committed by Daniel Borkmann
parent 52c84d36b7
commit 9be6d411b0
1 changed files with 1 additions and 1 deletions

View File

@ -244,7 +244,7 @@ static int do_batch(int argc, char **argv)
} }
if (errno && errno != ENOENT) { if (errno && errno != ENOENT) {
perror("reading batch file failed"); p_err("reading batch file failed: %s", strerror(errno));
err = -1; err = -1;
} else { } else {
p_info("processed %d lines", lines); p_info("processed %d lines", lines);