]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-bpf-token: fix build with libbpf < 0.6
authorLuca Boccassi <luca.boccassi@gmail.com>
Wed, 6 Aug 2025 12:50:56 +0000 (13:50 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 6 Aug 2025 13:09:33 +0000 (14:09 +0100)
../s/src/test/test-bpf-token.c: In function ‘intro’:
../s/src/test/test-bpf-token.c:10:5: error: "__LIBBPF_CURRENT_VERSION_GEQ" is not defined, evaluates to 0 [-Werror=undef]
   10 | #if __LIBBPF_CURRENT_VERSION_GEQ(1, 5)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../s/src/test/test-bpf-token.c:10:33: error: missing binary operator before token "("
   10 | #if __LIBBPF_CURRENT_VERSION_GEQ(1, 5)

Follow-up for ea9826eb946d57aaba7e6bfa2d6b120136c6b20f

src/test/test-bpf-token.c

index 3d6127182ec40ee43a788923c7693a114c00153c..ffdf822b8b364592af6f46bcf2ce0f743041fc3d 100644 (file)
@@ -7,7 +7,7 @@
 #include "tests.h"
 
 static int intro(void) {
-#if __LIBBPF_CURRENT_VERSION_GEQ(1, 5)
+#if defined(LIBBPF_MAJOR_VERSION) && (LIBBPF_MAJOR_VERSION > 1 || (LIBBPF_MAJOR_VERSION == 1 && LIBBPF_MINOR_VERSION >= 5))
         _cleanup_close_ int bpffs_fd = open("/sys/fs/bpf", O_RDONLY);
         if (bpffs_fd < 0)
                 return log_error_errno(errno, "Failed to open '/sys/fs/bpf': %m");