diff options
author | Quentin Monnet <quentin.monnet@netronome.com> | 2018-02-15 07:42:54 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-02-15 10:01:05 +0100 |
commit | 52c84d36b7e2f8197a9a6174d6f901a7c7afb850 (patch) | |
tree | 52b4b6401eba46301f0bb23e0dc26af753f8e278 /tools/bpf | |
parent | bpf: fix bpf_prog_array_copy_to_user warning from perf event prog query (diff) | |
download | linux-52c84d36b7e2f8197a9a6174d6f901a7c7afb850.tar.xz linux-52c84d36b7e2f8197a9a6174d6f901a7c7afb850.zip |
tools: bpftool: preserve JSON for batch mode when dumping insns to file
Print a "null" JSON object to standard output when bpftool is used to
print program instructions to a file, so as to avoid breaking JSON
output on batch mode.
This null object was added for most commands in a previous commit, but
this specific case had been omitted.
Fixes: 004b45c0e51a ("tools: bpftool: provide JSON output for all possible commands")
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>
Diffstat (limited to 'tools/bpf')
-rw-r--r-- | tools/bpf/bpftool/prog.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index e8e2baaf93c2..e549e329be82 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -774,6 +774,9 @@ static int do_dump(int argc, char **argv) n < 0 ? strerror(errno) : "short write"); goto err_free; } + + if (json_output) + jsonw_null(json_wtr); } else { if (member_len == &info.jited_prog_len) { const char *name = NULL; |