Skip to content

TcpSocket try_clone() sets close-on-exec but this isn't documented #47946

@setharnold

Description

@setharnold

Hello, the TcpSocket try_clone() method calls into .duplicate(), which sets the close-on-exec flag on the socket:

https://doc.rust-lang.org/src/std/net/tcp.rs.html#255-257
https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/fd.rs#L197

I believe the documentation for try_clone() should be extended to describe:

  • That this is an operation with the underlying operating system, dup() or WSADuplicateSocket() or whatever is appropriate (this would help address very similar issue 45536)
  • That the duplication operation also sets the close-on-exec flag.

Thanks

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.P-mediumMedium priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions