From: Martin Schwenke Date: Mon, 29 Sep 2025 04:58:01 +0000 (+1000) Subject: ctdb-common: Factor out new function run_event_fail() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20e9f203627752c4c1934e4bc0776e26c0dfb00e;p=thirdparty%2Fsamba.git ctdb-common: Factor out new function run_event_fail() Mostly due to future indentation requirements. Signed-off-by: Martin Schwenke Reviewed-by: Ralph Boehme --- diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c index 30369eeff22..efcf9942274 100644 --- a/ctdb/common/run_event.c +++ b/ctdb/common/run_event.c @@ -546,6 +546,9 @@ static void run_event_cancel(struct tevent_req *req); static void run_event_trigger(struct tevent_req *req, void *private_data); static struct tevent_req *run_event_run_script(struct tevent_req *req); static void run_event_next_script(struct tevent_req *subreq); +static void run_event_fail(struct tevent_req *req, + struct run_event_script *script, + id_t pid); static void run_event_debug(struct tevent_req *req, pid_t pid); static void run_event_debug_done(struct tevent_req *subreq); @@ -763,17 +766,7 @@ static void run_event_next_script(struct tevent_req *subreq) state->script_list->summary = script->summary; if (! state->continue_on_failure) { - state->script_list->num_scripts = state->index + 1; - - if (script->summary == -ETIMEDOUT && pid != -1) { - run_event_debug(req, pid); - } - D_NOTICE("%s event %s\n", state->event_str, - (script->summary == -ETIMEDOUT) ? - "timed out" : - "failed"); - run_event_stop_running(state->run_ctx); - tevent_req_done(req); + run_event_fail(req, script, pid); return; } } @@ -796,6 +789,25 @@ static void run_event_next_script(struct tevent_req *subreq) state->script_subreq = subreq; } +static void run_event_fail(struct tevent_req *req, + struct run_event_script *script, + id_t pid) +{ + struct run_event_state *state = tevent_req_data( + req, struct run_event_state); + + state->script_list->num_scripts = state->index + 1; + + if (script->summary == -ETIMEDOUT && pid != -1) { + run_event_debug(req, pid); + } + D_NOTICE("%s event %s\n", + state->event_str, + (script->summary == -ETIMEDOUT) ? "timed out" : "failed"); + run_event_stop_running(state->run_ctx); + tevent_req_done(req); +} + static void run_event_debug(struct tevent_req *req, pid_t pid) { struct run_event_state *state = tevent_req_data(