[Lldb-commits] [PATCH] Apply SOCK_CLOEXEC flag to socket API functions in order to avoid handle leakage to a forked child process.

Zachary Turner zturner at google.com
Mon Nov 10 20:43:10 PST 2014

I'm not sure it makes sense to put it on that constructor, because that
constructor takes an fd which has already been opened, so there would be no
way to set the flag on an already opened fd.

CFD has a default constructor though, it would probably make more sense on
that, and leave it off of the fd constructor.

On Mon Nov 10 2014 at 8:03:39 PM Oleksiy Vyalov <ovyalov at google.com> wrote:

> >>! In D6204#10, @zturner wrote:
> > Can I also request that the variable *not* be called close_on_exec?.  It
> is
> > possible to implement an equivalent on Windows, but calling it close on
> > exec will be confusing to people on Windows.  Can we come up with a more
> > generic name?  On Windows this would be called "inherit handles", which
> to
> > me sounds like a better name than close on exec, but I may be biased.  Is
> > "inherit handles" confusing to people on non-Windows?
> >
> > In other words, I'm proposing
> >
> > virtual lldb::ConnectionStatus ConnectionFileDescriptor::Connect(const
> char
> > *s, Error *error_ptr, bool close_on_exec = true);
> >
> > would become
> >
> > virtual lldb::ConnectionStatus ConnectionFileDescriptor::Connect(const
> char
> > *s, Error *error_ptr, bool inherit_handles = false);
> It sounds good to me to call this variable inherit_handles in order to
> make it more platform-independent.
> As I can see ConnectionFileDescriptor::Connect is overrides pure method
> from Connection::Connect (const char *url, Error *error_ptr)  and I'm a bit
> reluctant to make such variable visible for Communication layer  - so, I'm
> thinking about extending  ConnectionFileDescriptor constructor in a way
> like this:
> ConnectionFileDescriptor(int fd, bool owns_fd, bool inherit_handles =
> false);
> In this case methods within ConnectionFileDescriptor::Connect
> (SocketListen, NamedSocketAccept, NamedSocketAccept, ConnectTCP,
> ConnectUDP) may use member field m_inherit_handles instead of taking
> additional argument.
> http://reviews.llvm.org/D6204
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20141111/59ce00ce/attachment.html>

More information about the lldb-commits mailing list