diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-06-07 11:39:40 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-06-07 11:39:40 -0400 |
commit | a01cfacd423af28af6b7c13ba51e2395f3a52ee7 (patch) | |
tree | 9908154cf0a78da876115d47fcf1edc18ce279a7 | |
parent | e93a1dccd82f831a2f0d2cc382d8af5e1fda55ed (diff) | |
download | bfs-a01cfacd423af28af6b7c13ba51e2395f3a52ee7.tar.xz |
sighook: Ignore sigaction() errors in atsigexit()
This fixes bfs under Valgrind, which reserves SIGRTMAX for its own use.
-rw-r--r-- | src/sighook.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/sighook.c b/src/sighook.c index 3a7fb43..1146ea7 100644 --- a/src/sighook.c +++ b/src/sighook.c @@ -565,24 +565,20 @@ done: struct sighook *atsigexit(sighook_fn *fn, void *arg) { mutex_lock(&sigmutex); - struct sighook *ret = NULL; - for (size_t i = 0; i < countof(FATAL_SIGNALS); ++i) { - if (siginit(FATAL_SIGNALS[i]) != 0) { - goto done; - } + // Ignore errors; atsigexit() is best-effort anyway and things + // like sanitizer runtimes or valgrind may reserve signals for + // their own use + siginit(FATAL_SIGNALS[i]); } #ifdef SIGRTMIN for (int i = SIGRTMIN; i <= SIGRTMAX; ++i) { - if (siginit(i) != 0) { - goto done; - } + siginit(i); } #endif - ret = sighook_impl(&rcu_exithooks, 0, fn, arg, 0); -done: + struct sighook *ret = sighook_impl(&rcu_exithooks, 0, fn, arg, 0); mutex_unlock(&sigmutex); return ret; } |