From 62ac93a7b5adf4036695e8716d32758eed6eb180 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sun, 28 Apr 2024 17:48:09 -0300 Subject: landlock: fix building without landlock.h landlock.h may not be available on the system (such as with older versions of Linux API headers), so only try to include it if `HAVE_LANDLOCK` is defined. This fixes the following error from `build_debian_package` (which uses `debian:buster`) on GitLab CI[1]: $ ./mkdeb.sh --enable-fatal-warnings [...] gcc [...] -c ../../src/firejail/landlock.c -o ../../src/firejail/landlock.o ../../src/firejail/landlock.c:22:10: fatal error: linux/landlock.h: No such file or directory #include ^~~~~~~~~~~~~~~~~~ compilation terminated. This amends commit a05ae97af ("landlock: amend empty functions and comments", 2024-04-08) / PR #6305. Relates to #6078. [1] https://gitlab.com/Firejail/firejail_ci/-/jobs/6743161059 --- src/firejail/landlock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/firejail/landlock.c b/src/firejail/landlock.c index a360f155b..3ac1bddae 100644 --- a/src/firejail/landlock.c +++ b/src/firejail/landlock.c @@ -19,7 +19,6 @@ */ #include "firejail.h" -#include #include #include #include @@ -28,6 +27,8 @@ #ifdef HAVE_LANDLOCK +#include + static int ll_ruleset_fd = -1; static int ll_abi = -1; -- cgit v1.2.3-54-g00ecf