From 2f28844a1099d16607b6b54d382b2fb9e2ba64a2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 27 Mar 2006 12:32:42 +0000 Subject: r14744: allow ./timelimit 5 ./timelimit 20 ./ignore_all_signals to work, this is needed when we enable samba3's make test in the build-farm metze (This used to be commit b120c21669a91a097f044530a1f7c59043465841) --- source3/script/tests/timelimit.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/timelimit.c b/source3/script/tests/timelimit.c index af8ff27454..dc11720ec1 100644 --- a/source3/script/tests/timelimit.c +++ b/source3/script/tests/timelimit.c @@ -22,17 +22,25 @@ static void usage(void) printf(" SIGTERM - passes SIGTERM to command's process group and exit(0)\n"); } -static void sig_alrm(int sig) +static void sig_alrm_kill(int sig) { fprintf(stderr, "\nMaximum time expired in timelimit - killing\n"); kill(-child_pid, SIGKILL); exit(1); } +static void sig_alrm_term(int sig) +{ + kill(-child_pid, SIGTERM); + alarm(5); + signal(SIGALRM, sig_alrm_kill); +} + static void sig_term(int sig) { kill(-child_pid, SIGTERM); - exit(0); + alarm(1); + signal(SIGALRM, sig_alrm_kill); } static void sig_usr1(int sig) @@ -78,7 +86,7 @@ int main(int argc, char *argv[]) signal(SIGTERM, sig_term); signal(SIGUSR1, sig_usr1); - signal(SIGALRM, sig_alrm); + signal(SIGALRM, sig_alrm_term); alarm(maxtime); do { -- cgit