From: Christof Schmitt Date: Thu, 15 Dec 2011 20:53:48 +0000 (-0700) Subject: smbtorture: Do not leak child processes when exiting X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=c892217a1236a5fde9072d726605e2e1b610a160;p=metze%2Fsamba%2Fwip.git 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 --- diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index c9a4a0e1b2b7..9efa33437ccf 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); }