Skip to content

Commit 15c65b5

Browse files
committed
Explicit cloexec flag when using dup2
1 parent 1f9bd44 commit 15c65b5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/unix/lwt_process.cppo.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ let unix_redirect fd redirection = match redirection with
123123
()
124124
| `Dev_null ->
125125
let dev_null = Unix.openfile "/dev/null" [Unix.O_RDWR; Unix.O_KEEPEXEC] 0o666 in
126-
Unix.dup2 dev_null fd;
126+
Unix.dup2 ~cloexec:false dev_null fd;
127127
Unix.close dev_null
128128
| `Close ->
129129
Unix.close fd
130130
| `FD_copy fd' ->
131-
Unix.dup2 fd' fd
131+
Unix.dup2 ~cloexec:false fd' fd
132132
| `FD_move fd' ->
133-
Unix.dup2 fd' fd;
133+
Unix.dup2 ~cloexec:false fd' fd;
134134
Unix.close fd'
135135

136136
#if OCAML_VERSION >= (5, 0, 0)

0 commit comments

Comments
 (0)