summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2022-11-09 14:05:59 +0100
committerStefan Metzmacher <metze@samba.org>2023-01-18 16:26:36 +0000
commit96e4be0a799666414add1a3e80830832dc6f7cb9 (patch)
treee4c23068e7f88dbf75ec3805ff6d73c129fc7f79 /lib/util
parenta92150ed0ef25623bc2f2476060fc845f673d29f (diff)
downloadsamba-96e4be0a799666414add1a3e80830832dc6f7cb9.tar.gz
lib/util: install a tevent_abort callback using smb_panic()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/tevent_debug.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/util/tevent_debug.c b/lib/util/tevent_debug.c
index 48f65299c5d..bc3dd0ca944 100644
--- a/lib/util/tevent_debug.c
+++ b/lib/util/tevent_debug.c
@@ -68,9 +68,25 @@ static void samba_tevent_debug(void *context,
}
}
+static void samba_tevent_abort_fn(const char *reason)
+{
+ smb_panic(reason);
+}
+
+static void samba_tevent_setup_abort_fn(void)
+{
+ static bool abort_fn_done;
+
+ if (!abort_fn_done) {
+ tevent_set_abort_fn(samba_tevent_abort_fn);
+ abort_fn_done = true;
+ }
+}
+
void samba_tevent_set_debug(struct tevent_context *ev, const char *name)
{
void *p = discard_const(name);
+ samba_tevent_setup_abort_fn();
tevent_set_debug(ev, samba_tevent_debug, p);
}
@@ -78,6 +94,8 @@ struct tevent_context *samba_tevent_context_init(TALLOC_CTX *mem_ctx)
{
struct tevent_context *ev;
+ samba_tevent_setup_abort_fn();
+
ev = tevent_context_init(mem_ctx);
if (ev) {
samba_tevent_set_debug(ev, NULL);