summaryrefslogtreecommitdiffstats
path: root/openbsc/src/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/signal.c')
-rw-r--r--openbsc/src/signal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/signal.c b/openbsc/src/signal.c
index 41352fb..bf5671e 100644
--- a/openbsc/src/signal.c
+++ b/openbsc/src/signal.c
@@ -39,9 +39,6 @@ int register_signal_handler(unsigned int subsys, signal_cbfn *cbfn, void *data)
{
struct signal_handler *sig_data;
- if (!tall_sigh_ctx)
- tall_sigh_ctx = talloc_named_const(NULL, 1, "signal_handler");
-
sig_data = talloc(tall_sigh_ctx, struct signal_handler);
if (!sig_data)
return -ENOMEM;
@@ -84,3 +81,8 @@ void dispatch_signal(unsigned int subsys, unsigned int signal, void *signal_data
(*handler->cbfn)(subsys, signal, handler->data, signal_data);
}
}
+
+static __attribute__((constructor)) void on_dso_load_signal(void)
+{
+ tall_sigh_ctx = talloc_named_const(NULL, 1, "signal_handler");
+}