aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-10-09 18:13:08 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-10-22 19:03:52 +0300
commit2e2cd11535ad77364cf021297e0b3f162fa3a3d0 (patch)
tree4623ea1dc5da7596b1f5d2de885b466f9bf45a1f /src/xz/file_io.c
parentxz/Windows: Allow clock_gettime with POSIX threads. (diff)
downloadxz-2e2cd11535ad77364cf021297e0b3f162fa3a3d0.tar.xz
Simplify detection of Capsicum support.
This removes support for FreeBSD 10.0 and 10.1 which used <sys/capability.h> instead of <sys/capsicum.h>. Support for FreeBSD 10.1 ended on 2016-12-31. So now FreeBSD >= 10.2 is required to enable Capsicum support. This also removes support for Capsicum on Linux (libcaprights) which seems to have been unmaintained since 2017 and Linux 4.11: https://github.com/google/capsicum-linux
Diffstat (limited to 'src/xz/file_io.c')
-rw-r--r--src/xz/file_io.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/xz/file_io.c b/src/xz/file_io.c
index 55652c53..5a7d317f 100644
--- a/src/xz/file_io.c
+++ b/src/xz/file_io.c
@@ -29,12 +29,8 @@ static bool warn_fchown;
# include <utime.h>
#endif
-#ifdef HAVE_CAPSICUM
-# ifdef HAVE_SYS_CAPSICUM_H
-# include <sys/capsicum.h>
-# else
-# include <sys/capability.h>
-# endif
+#ifdef HAVE_CAP_RIGHTS_LIMIT
+# include <sys/capsicum.h>
#endif
#include "tuklib_open_stdxxx.h"
@@ -214,8 +210,8 @@ io_sandbox_enter(int src_fd)
// characters have been loaded. This is needed at least with glibc.
tuklib_mbstr_width(dummy_str, NULL);
-#ifdef HAVE_CAPSICUM
- // Capsicum needs FreeBSD 10.0 or later.
+#ifdef HAVE_CAP_RIGHTS_LIMIT
+ // Capsicum needs FreeBSD 10.2 or later.
cap_rights_t rights;
if (cap_enter())
@@ -266,7 +262,7 @@ io_sandbox_enter(int src_fd)
return;
error:
-#ifdef HAVE_CAPSICUM
+#ifdef HAVE_CAP_RIGHTS_LIMIT
// If a kernel is configured without capability mode support or
// used in an emulator that does not implement the capability
// system calls, then the Capsicum system calls will fail and set