From 206f4a4ec05cb7ce2f8f47c8f5b4b2c80ea221a2 Mon Sep 17 00:00:00 2001 From: Giulio Benetti Date: Tue, 1 Apr 2025 00:53:07 +0200 Subject: Fix build with kernel < 5.9 linux/close_range.h is only available since kernel 5.9 and https://github.com/torvalds/linux/commit/60997c3d45d9a67daf01c56d805ae4fec37e0bd8 resulting in the following build failure: ../util/fusermount.c:40:10: fatal error: linux/close_range.h: No such file or directory So let's check for header presence and emit HAVE_LINUX_CLOSE_RANGE_H accordingly and check for it when including and calling close_range() instead of checking for close_range() function in meson and check against HAVE_CLOSE_RANGE. Signed-off-by: Giulio Benetti --- util/fusermount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util/fusermount.c') diff --git a/util/fusermount.c b/util/fusermount.c index dbd947c..da6d5f2 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -36,7 +36,7 @@ #include #include -#ifdef HAVE_CLOSE_RANGE +#ifdef HAVE_LINUX_CLOSE_RANGE_H #include #endif @@ -1477,7 +1477,7 @@ static int close_inherited_fds(int cfd) if (cfd <= STDERR_FILENO) return -EINVAL; -#ifdef HAVE_CLOSE_RANGE +#ifdef HAVE_LINUX_CLOSE_RANGE_H if (cfd < STDERR_FILENO + 2) { close_range_loop(STDERR_FILENO + 1, cfd - 1, cfd); } else { -- cgit v1.2.3