The commit e5043894b21f ("bpftool: Use libbpf_get_error() to check error") forced map dump with pretty print enabled to has BTF loaded, which is not necessarily needed. Keeping the libbpf_get_error call, but setting errno to 0 because get_map_kv_btf does nothing for this case. This fixes test_offload.py for me, which failed because of the pretty print fails with: Test map dump... Traceback (most recent call last): File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 1251, in <module> _, entries = bpftool("map dump id %d" % (m["id"])) File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 169, in bpftool return tool("bpftool", args, {"json":"-p"}, JSON=JSON, ns=ns, File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 155, in tool ret, stdout = cmd(ns + name + " " + params + args, File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 109, in cmd return cmd_result(proc, include_stderr=include_stderr, fail=fail) File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 131, in cmd_result raise Exception("Command failed: %s\n%s" % (proc.args, stderr)) Exception: Command failed: bpftool -p map dump id 4325 Fixes: e5043894b21f ("bpftool: Use libbpf_get_error() to check error") Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> --- tools/bpf/bpftool/map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index c66a3c979b7a..2ccf85042e75 100644 --- a/tools/bpf/bpftool/map.c +++ b/tools/bpf/bpftool/map.c @@ -862,6 +862,7 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr, prev_key = NULL; if (wtr) { + errno = 0; btf = get_map_kv_btf(info); err = libbpf_get_error(btf); if (err) { -- 2.34.1