From: Volker Lendecke Date: Tue, 18 May 2021 06:23:05 +0000 (+0200) Subject: ctdb: Wait for SIGCHLD if script timed out X-Git-Tag: tevent-0.11.0~863 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=19290f10c7d39e055847eb45affd9e229a116b18;p=thirdparty%2Fsamba.git ctdb: Wait for SIGCHLD if script timed out Bug: https://bugzilla.samba.org/show_bug.cgi?id=14475 Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/ctdb/tests/src/run_event_test.c b/ctdb/tests/src/run_event_test.c index 61c4ecc30f9..08e8b95e13d 100644 --- a/ctdb/tests/src/run_event_test.c +++ b/ctdb/tests/src/run_event_test.c @@ -75,6 +75,7 @@ static void do_run(TALLOC_CTX *mem_ctx, struct tevent_context *ev, char *arg_str; unsigned int i; int t; + bool wait_for_signal = false; if (argc < 5) { usage(argv[0]); @@ -116,7 +117,28 @@ static void do_run(TALLOC_CTX *mem_ctx, struct tevent_context *ev, for (i=0; inum_scripts; i++) { struct run_event_script *s = &script_list->script[i]; printf("%s result=%d\n", s->name, s->summary); + + if (s->summary == -ETIMEDOUT) { + wait_for_signal = true; + } + } + + TALLOC_FREE(script_list); + TALLOC_FREE(req); + + if (!wait_for_signal) { + return; } + + req = tevent_wakeup_send( + ev, ev, tevent_timeval_current_ofs(1, 0)); + if (req == NULL) { + fprintf(stderr, "Could not wait for signal\n"); + return; + } + + tevent_req_poll(req, ev); + TALLOC_FREE(req); } static void do_list(TALLOC_CTX *mem_ctx, struct tevent_context *ev,