From 507440dfa314412f764448f885b373f53b649fb0 Mon Sep 17 00:00:00 2001 From: David Scott Date: Wed, 3 Feb 2010 22:33:21 +0000 Subject: [PATCH] CA-36554: call setsid() before exec() to make sure children don't accidentally kill us when they (eg) send their entire process group a SIGQUIT. Signed-off-by: David Scott --- forking_executioner/child.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forking_executioner/child.ml b/forking_executioner/child.ml index 464e657..9ebe326 100644 --- a/forking_executioner/child.ml +++ b/forking_executioner/child.ml @@ -129,6 +129,9 @@ let run state comms_sock fd_sock fd_sock_path = (* Now let's close everything except those fds mentioned in the ids_received list *) Unixext.close_all_fds_except ([Unix.stdin; Unix.stdout; Unix.stderr] @ fds); + (* Distance ourselves from our parent process: *) + if Unix.setsid () == -1 then failwith "Unix.setsid failed"; + (* And exec *) Unix.execve (List.hd args) (Array.of_list args) (Array.of_list state.env) end else begin -- 2.39.5