Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eio_linux: add some missing close-on-execs #441

Merged
merged 2 commits into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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