mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb: Call run_event_recv() in a callback function
Triggers a different code path in run_event_* and aligns it more what the ctdb eventd really does. Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
f188c9d732
commit
9398d4b912
@ -52,6 +52,19 @@ static char *compact_args(const char **argv, int argc, int from)
|
||||
return arg_str;
|
||||
}
|
||||
|
||||
static void run_done(struct tevent_req *req)
|
||||
{
|
||||
struct run_event_script_list **script_list =
|
||||
tevent_req_callback_data_void(req);
|
||||
bool status;
|
||||
int ret;
|
||||
|
||||
status = run_event_recv(req, &ret, NULL, script_list);
|
||||
if (!status) {
|
||||
fprintf(stderr, "run_event_recv() failed, ret=%d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
static void do_run(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
struct run_event_context *run_ctx,
|
||||
int argc, const char **argv)
|
||||
@ -61,8 +74,7 @@ static void do_run(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
struct run_event_script_list *script_list = NULL;
|
||||
char *arg_str;
|
||||
unsigned int i;
|
||||
int ret, t;
|
||||
bool status;
|
||||
int t;
|
||||
|
||||
if (argc < 5) {
|
||||
usage(argv[0]);
|
||||
@ -90,13 +102,9 @@ static void do_run(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
return;
|
||||
}
|
||||
|
||||
tevent_req_poll(req, ev);
|
||||
tevent_req_set_callback(req, run_done, &script_list);
|
||||
|
||||
status = run_event_recv(req, &ret, mem_ctx, &script_list);
|
||||
if (! status) {
|
||||
fprintf(stderr, "run_event_recv() failed, ret=%d\n", ret);
|
||||
return;
|
||||
}
|
||||
tevent_req_poll(req, ev);
|
||||
|
||||
if (script_list == NULL || script_list->num_scripts == 0) {
|
||||
printf("No event scripts found\n");
|
||||
|
Loading…
Reference in New Issue
Block a user