summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@us.ibm.com>2011-12-15 13:53:48 -0700
committerJeremy Allison <jra@samba.org>2012-02-02 01:35:27 +0100
commitc892217a1236a5fde9072d726605e2e1b610a160 (patch)
tree011a044f6b08d22ef3ea36fad4b30efcf089d46f /source4/torture
parent3101d9bc2d741f57f04d48d5613d8f1c9697ef8e (diff)
downloadsamba-c892217a1236a5fde9072d726605e2e1b610a160.tar.gz
samba-c892217a1236a5fde9072d726605e2e1b610a160.tar.bz2
samba-c892217a1236a5fde9072d726605e2e1b610a160.zip
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 <jra@samba.org> Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Feb 2 01:35:27 CET 2012 on sn-devel-104
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/util_smb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index c9a4a0e1b2..9efa33437c 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);
}