Skip to content

Commit

Permalink
Merge pull request #441 from talex5/cloexec
Browse files Browse the repository at this point in the history
eio_linux: add some missing close-on-execs
  • Loading branch information
haesbaert authored Feb 14, 2023
2 parents f9b2924 + 32a3088 commit 45efcc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib_eio_linux/eio_linux.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ let net = object
let host = Eio_unix.Ipaddr.to_unix host in
Unix.SOCK_STREAM, Unix.ADDR_INET (host, port)
in
let sock_unix = Unix.socket (socket_domain_of listen_addr) socket_type 0 in
let sock_unix = Unix.socket ~cloexec:true (socket_domain_of listen_addr) socket_type 0 in
(* For Unix domain sockets, remove the path when done (except for abstract sockets). *)
begin match listen_addr with
| `Unix path ->
Expand All @@ -1118,14 +1118,14 @@ let net = object
listening_socket sock

method connect ~sw connect_addr =
let socket_type, addr =
let addr =
match connect_addr with
| `Unix path -> Unix.SOCK_STREAM, Unix.ADDR_UNIX path
| `Unix path -> Unix.ADDR_UNIX path
| `Tcp (host, port) ->
let host = Eio_unix.Ipaddr.to_unix host in
Unix.SOCK_STREAM, Unix.ADDR_INET (host, port)
Unix.ADDR_INET (host, port)
in
let sock_unix = Unix.socket (socket_domain_of connect_addr) socket_type 0 in
let sock_unix = Unix.socket ~cloexec:true (socket_domain_of connect_addr) Unix.SOCK_STREAM 0 in
let sock = FD.of_unix ~sw ~seekable:false ~close_unix:true sock_unix in
Low_level.connect sock addr;
(flow sock :> <Eio.Flow.two_way; Eio.Flow.close>)
Expand Down

0 comments on commit 45efcc4

Please sign in to comment.