]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
lib/bpf: add missing limits.h includes
authorTony Ambardar <tony.ambardar@gmail.com>
Thu, 11 Mar 2021 21:47:54 +0000 (13:47 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 17 Mar 2021 05:53:53 +0000 (22:53 -0700)
Several functions in bpf_glue.c and bpf_libbpf.c rely on PATH_MAX, which is
normally included from <limits.h> in other iproute2 source files.

It fixes errors seen using gcc 10.2.0, binutils 2.35.1 and musl 1.1.24:

bpf_glue.c: In function 'get_libbpf_version':
bpf_glue.c:46:11: error: 'PATH_MAX' undeclared (first use in this function);
did you mean 'AF_MAX'?
   46 |  char buf[PATH_MAX], *s;
      |           ^~~~~~~~
      |           AF_MAX

Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/bpf_glue.c
lib/bpf_libbpf.c

index d00a0dc1758e4e4a305bcdd238006e5044c1c971..eaa9504f34fb36a8a1f2c9165d318409eb458688 100644 (file)
@@ -4,6 +4,8 @@
  * Authors:    Hangbin Liu <haliu@redhat.com>
  *
  */
+#include <limits.h>
+
 #include "bpf_util.h"
 #ifdef HAVE_LIBBPF
 #include <bpf/bpf.h>
index d05737a446a568317a8d17251143abf165e94c41..864f8c351b7d38e056121d93cefa0d5ce35f2563 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdint.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h>
 
 #include <libelf.h>
 #include <gelf.h>