Skip to content

Commit

Permalink
Explicit cloexec flag when using dup2
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Jun 28, 2022
1 parent 1f9bd44 commit 15c65b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/unix/lwt_process.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 15c65b5

Please sign in to comment.