bcc/libbpf: Fix bpf_has_kernel_btf return status
bool returns True for negative integers. Hence bcc tools
tries to switch to kfunc instead of kprobes, even when the
btf data is not found.
For libbpf_find_vmlinux_btf_id, When err <= 0 , btf is not found.
Acked-by: Ilya Leoshkevich
@@ -1168,7 +1168,7 @@ int bpf_attach_raw_tracepoint(int progfd, const char *tp_name)
bool bpf_has_kernel_btf(void)
{
- return libbpf_find_vmlinux_btf_id("bpf_prog_put", 0);
+ return libbpf_find_vmlinux_btf_id("bpf_prog_put", 0) > 0;
}
int bpf_detach_kfunc(int prog_fd, char *func)
