1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Stefan Metzmacher 2022-11-09 14:05:59 +01:00
parent a92150ed0e
commit 96e4be0a79

View File

@ -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);