From 15c65b5aae79e5428242af51d782176e9ccce7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 27 Jun 2022 16:16:35 +0200 Subject: [PATCH] Explicit cloexec flag when using dup2 --- src/unix/lwt_process.cppo.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/unix/lwt_process.cppo.ml b/src/unix/lwt_process.cppo.ml index 7cbd775ae..791e38ba7 100644 --- a/src/unix/lwt_process.cppo.ml +++ b/src/unix/lwt_process.cppo.ml @@ -123,14 +123,14 @@ let unix_redirect fd redirection = match redirection with () | `Dev_null -> let dev_null = Unix.openfile "/dev/null" [Unix.O_RDWR; Unix.O_KEEPEXEC] 0o666 in - Unix.dup2 dev_null fd; + Unix.dup2 ~cloexec:false dev_null fd; Unix.close dev_null | `Close -> Unix.close fd | `FD_copy fd' -> - Unix.dup2 fd' fd + Unix.dup2 ~cloexec:false fd' fd | `FD_move fd' -> - Unix.dup2 fd' fd; + Unix.dup2 ~cloexec:false fd' fd; Unix.close fd' #if OCAML_VERSION >= (5, 0, 0)