From c892217a1236a5fde9072d726605e2e1b610a160 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 15 Dec 2011 13:53:48 -0700 Subject: [PATCH] smbtorture: Do not leak child processes when exiting When some child processes could not be created, smbtorture would exit and leave the successfully started child processes running. Add a loop to kill the existing child processes for this case. Signed-off-by: Jeremy Allison Autobuild-User: Jeremy Allison Autobuild-Date: Thu Feb 2 01:35:27 CET 2012 on sn-devel-104 --- source4/torture/util_smb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index c9a4a0e1b2b..9efa33437cc 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -729,6 +729,14 @@ double torture_create_procs(struct torture_context *tctx, if (synccount != torture_nprocs) { printf("FAILED TO START %d CLIENTS (started %d)\n", torture_nprocs, synccount); + + /* cleanup child processes */ + for (i = 0; i < torture_nprocs; i++) { + if (child_status[i]) { + kill(child_status[i], SIGTERM); + } + } + *result = false; return timeval_elapsed(&tv); } -- 2.11.4.GIT