Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-01-14 15:21:44 +0100
committerMartin Hořeňovský2017-01-14 15:21:44 +0100
commitffc4a9dc143bc66d2e1fd883e1395a3397a68e9d (patch)
tree5c598362c53935eb2adec2fce0dfb9af0a8a8513 /include/internal
parent7c8b93eac3e63397d334b91755321bfb2982e1d1 (diff)
downloadcatch3-ffc4a9dc143bc66d2e1fd883e1395a3397a68e9d.tar.gz
If we receive a signal, we re-register ALL previous signal handlers.
This fixes the case when we pass signal to previously registered handler, and it needs to transform the signal into different one. Still problematic: What if the signal handler we replaced does not terminate the application? We can end up in a weird state and loop forever. Possible solution: Deregister our signal handlers, CALL the previous signal handler explicitly and if control returns, abort. This would however complicate our code quite a bit, as we would have to parse the sigaction we delegate to, decide whether to use signal handler or signal action, etc...
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/catch_fatal_condition.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp
index 895b662d..f99c8f26 100644
--- a/include/internal/catch_fatal_condition.hpp
+++ b/include/internal/catch_fatal_condition.hpp
@@ -118,10 +118,10 @@ namespace Catch {
SignalDefs &def = signalDefs[i];
if (sig == def.id) {
name = def.name;
- sigaction(def.id, &oldSigActions[i], CATCH_NULL);
break;
}
}
+ reset();
reportFatal(name, -sig);
raise( sig );
}
@@ -146,7 +146,7 @@ namespace Catch {
~FatalConditionHandler() {
reset();
}
- void reset() {
+ static void reset() {
if( isSet ) {
// Set signals back to previous values -- hopefully nobody overwrote them in the meantime
for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {