[PATCH 22/22] Including <linux/capability.h> iff it exists.

Alejandro Colomar alx.manpages at gmail.com
Sun Jun 19 13:50:32 UTC 2022


---
 auto/headers         | 13 +++++++++++++
 src/nxt_capability.c |  6 ++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/auto/headers b/auto/headers
index a240b2d5..835d4096 100644
--- a/auto/headers
+++ b/auto/headers
@@ -3,6 +3,19 @@
 # System headers.
 
 
+nxt_feature="<linux/capability.h>"
+nxt_feature_name=NXT_HAVE_LINUX_CAPABILITY_H
+nxt_feature_run=no
+nxt_feature_incs=
+nxt_feature_libs=
+nxt_feature_test="#include <linux/capability.h>
+
+                  int main(void) {
+                      return 0;
+                  }"
+. auto/feature
+
+
 nxt_feature="<linux/memfd.h>"
 nxt_feature_name=NXT_HAVE_LINUX_MEMFD_H
 nxt_feature_run=no
diff --git a/src/nxt_capability.c b/src/nxt_capability.c
index 13e01329..d225f028 100644
--- a/src/nxt_capability.c
+++ b/src/nxt_capability.c
@@ -8,11 +8,13 @@
 
 #include <sys/syscall.h>
 
-#if (NXT_HAVE_LINUX_CAPABILITY)
-
+#if (NXT_HAVE_LINUX_CAPABILITY_H)
 #include <linux/capability.h>
+#endif
 
 
+#if (NXT_HAVE_LINUX_CAPABILITY)
+
 #if (_LINUX_CAPABILITY_VERSION_3)
 #define NXT_CAPABILITY_VERSION  _LINUX_CAPABILITY_VERSION_3
 #elif (_LINUX_CAPABILITY_VERSION_2)
-- 
2.36.1



More information about the unit mailing list