1From 65e1b96bd40cb14b3729ac56bb9f1fcb77254403 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Tue, 1 Nov 2022 14:16:01 +0100
4Subject: [PATCH] fix build with kernel < 5.9
5
6linux/close_range.h is only available since kernel 5.9 and
7https://github.com/torvalds/linux/commit/60997c3d45d9a67daf01c56d805ae4fec37e0bd8
8resulting in the following build failure:
9
10catatonit.c:39:11: fatal error: linux/close_range.h: No such file or directory
11   39 | # include <linux/close_range.h>
12      |           ^~~~~~~~~~~~~~~~~~~~~
13
14Fixes:
15 - http://autobuild.buildroot.org/results/ed9a847905083175c7fcb2f2df28f9ac5b9c3313
16
17Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
18Upstream: https://github.com/openSUSE/catatonit/commit/663ad1670689143f65af3a288f90cecb7feed54f
19---
20 catatonit.c  | 2 +-
21 configure.ac | 2 +-
22 2 files changed, 2 insertions(+), 2 deletions(-)
23
24diff --git a/catatonit.c b/catatonit.c
25index a33f4cd..b10d9b0 100644
26--- a/catatonit.c
27+++ b/catatonit.c
28@@ -36,7 +36,7 @@
29 #include <limits.h>
30 #include <dirent.h>
31
32-#ifdef HAVE_CLOSE_RANGE
33+#ifdef HAVE_LINUX_CLOSE_RANGE_H
34 # include <linux/close_range.h>
35 #else
36 # include <sys/syscall.h>
37diff --git a/configure.ac b/configure.ac
38index 69e89f0..b37f146 100644
39--- a/configure.ac
40+++ b/configure.ac
41@@ -24,7 +24,7 @@ LT_PREREQ([2.4.2])
42 LT_INIT([disable-shared])
43
44 AC_CHECK_HEADERS([errno.h fcntl.h signal.h stdarg.h stdio.h stdlib.h unistd.h])
45-AC_CHECK_HEADERS([sys/prctl.h sys/signalfd.h sys/stat.h sys/types.h sys/wait.h])
46+AC_CHECK_HEADERS([linux/close_range.h sys/prctl.h sys/signalfd.h sys/stat.h sys/types.h sys/wait.h])
47
48 AC_CHECK_FUNCS([close_range])
49
50