summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-05-18 08:23:05 +0200
committerRalph Boehme <slow@samba.org>2021-05-18 10:42:32 +0000
commit19290f10c7d39e055847eb45affd9e229a116b18 (patch)
tree2a5b871b7ee757c65361531102bb2960f0b5abee /ctdb
parent07ab9b7a71d59f3ff2b9dee662632315062213ab (diff)
downloadsamba-19290f10c7d39e055847eb45affd9e229a116b18.tar.gz
ctdb: Wait for SIGCHLD if script timed out
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>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/src/run_event_test.c22
1 files changed, 22 insertions, 0 deletions
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; i<script_list->num_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,