Skip to content

Commit f871218

Browse files
committed
sandbox.cpp: use sandbox on 10.7+
1 parent 3fa1d99 commit f871218

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/cli/sandbox.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010
#include <botan/internal/target_info.h>
1111
#include <memory>
1212

13+
#if defined(BOTAN_TARGET_OS_IS_MACOS)
14+
#include <AvailabilityMacros.h>
15+
#endif
16+
1317
#if defined(BOTAN_TARGET_OS_HAS_CAP_ENTER)
1418
#include <sys/capsicum.h>
1519
#include <unistd.h>
1620
#elif defined(BOTAN_TARGET_OS_HAS_SETPPRIV)
1721
#include <priv.h>
18-
#elif defined(BOTAN_TARGET_OS_HAS_SANDBOX_PROC)
22+
// macOS 10.6 has sandbox, but does not have sandbox_init
23+
#elif defined(BOTAN_TARGET_OS_HAS_SANDBOX_PROC) && \
24+
!(defined(BOTAN_TARGET_OS_IS_MACOS) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
1925
#include <sandbox.h>
2026
#endif
2127

@@ -35,7 +41,8 @@ Sandbox::Sandbox() {
3541
m_name = "capsicum";
3642
#elif defined(BOTAN_TARGET_OS_HAS_SETPPRIV)
3743
m_name = "privilege";
38-
#elif defined(BOTAN_TARGET_OS_HAS_SANDBOX_PROC)
44+
#elif defined(BOTAN_TARGET_OS_HAS_SANDBOX_PROC) && \
45+
!(defined(BOTAN_TARGET_OS_IS_MACOS) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
3946
m_name = "sandbox";
4047
#else
4148
m_name = "<none>";
@@ -93,7 +100,8 @@ bool Sandbox::init() {
93100
}
94101

95102
return true;
96-
#elif defined(BOTAN_TARGET_OS_HAS_SANDBOX_PROC)
103+
#elif defined(BOTAN_TARGET_OS_HAS_SANDBOX_PROC) && \
104+
!(defined(BOTAN_TARGET_OS_IS_MACOS) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
97105

98106
BOTAN_DIAGNOSTIC_PUSH
99107
BOTAN_DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS

0 commit comments

Comments
 (0)