summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ctx.c4
-rw-r--r--src/sighook.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/ctx.c b/src/ctx.c
index fac501a..0f619c2 100644
--- a/src/ctx.c
+++ b/src/ctx.c
@@ -229,9 +229,7 @@ static int bfs_ctx_fclose(struct bfs_ctx *ctx, struct bfs_ctx_file *ctx_file) {
error = errno;
}
- if (ctx_file->hook) {
- sigunhook(ctx_file->hook);
- }
+ sigunhook(ctx_file->hook);
// Close the CFILE, except for stdio streams, which are closed later
if (cfile != ctx->cout && cfile != ctx->cerr) {
diff --git a/src/sighook.c b/src/sighook.c
index ff5b96f..ece8147 100644
--- a/src/sighook.c
+++ b/src/sighook.c
@@ -584,6 +584,10 @@ done:
}
void sigunhook(struct sighook *hook) {
+ if (!hook) {
+ return;
+ }
+
mutex_lock(&sigmutex);
struct rcu *rcu = hook->sig ? &rcu_sighooks : &rcu_exithooks;