From: Eric Leblond Date: Sun, 7 Jan 2018 11:59:16 +0000 (+0100) Subject: util-ebpf: fix libbpf error handling X-Git-Tag: suricata-4.1.0-beta1~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1515b48ad4fe42bbdd474b461bf0a9a6dcca0d5;p=thirdparty%2Fsuricata.git util-ebpf: fix libbpf error handling --- diff --git a/src/util-ebpf.c b/src/util-ebpf.c index a904cb1943..1fac35b907 100644 --- a/src/util-ebpf.c +++ b/src/util-ebpf.c @@ -116,9 +116,6 @@ int EBPFGetMapFDByName(const char *iface, const char *name) return -1; } -#define bpf__is_error(ee) ee -#define bpf__get_error(ee) 1 - /** * Load a section of an eBPF file * @@ -161,10 +158,10 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section, } bpfobj = bpf_object__open(path); - - if (libbpf_get_error(bpfobj)) { + long error = libbpf_get_error(bpfobj); + if (error) { char err_buf[128]; - libbpf_strerror(bpf__get_error(bpfobj), err_buf, + libbpf_strerror(error, err_buf, sizeof(err_buf)); SCLogError(SC_ERR_INVALID_VALUE, "Unable to load eBPF objects in '%s': %s",