summaryrefslogtreecommitdiff
path: root/dev-libs/leatherman/files/leatherman-1.12.6-SIGSTKSZ.patch
blob: e6c7349e814b1da04852d88931a01020d95086c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
diff -Naur a/src/Catch-1.10.0/single_include/catch.hpp b/src/Catch-1.10.0/single_include/catch.hpp
--- a/src/Catch-1.10.0/single_include/catch.hpp	2021-07-05 07:30:43.000000000 -0500
+++ b/src/Catch-1.10.0/single_include/catch.hpp	2021-12-17 01:34:41.000000000 -0600
@@ -6447,6 +6447,14 @@
 
 #  else // CATCH_CONFIG_POSIX_SIGNALS is defined
 
+#    if defined(_SC_SIGSTKSZ_SOURCE) || defined(_GNU_SOURCE)
+// on glibc > 2.33 this is no longer constant, see
+// https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=85e84fe53699fe9e392edffa993612ce08b2954a;hb=HEAD
+static constexpr std::size_t sigStackSize = 32768;
+#    else
+static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
+#    endif
+
 #include <signal.h>
 
 namespace Catch {
@@ -6470,7 +6478,7 @@
         static bool isSet;
         static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)];
         static stack_t oldSigStack;
-        static char altStackMem[SIGSTKSZ];
+        static char altStackMem[sigStackSize];
 
         static void handleSignal( int sig ) {
             std::string name = "<unknown signal>";
@@ -6490,7 +6498,7 @@
             isSet = true;
             stack_t sigStack;
             sigStack.ss_sp = altStackMem;
-            sigStack.ss_size = SIGSTKSZ;
+            sigStack.ss_size = sigStackSize;
             sigStack.ss_flags = 0;
             sigaltstack(&sigStack, &oldSigStack);
             struct sigaction sa = { 0 };
@@ -6521,7 +6529,7 @@
     bool FatalConditionHandler::isSet = false;
     struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
     stack_t FatalConditionHandler::oldSigStack = {};
-    char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
+    char FatalConditionHandler::altStackMem[sigStackSize] = {};
 
 } // namespace Catch