Re: I'm done with O_CLOEXEC



On Sat, 2015-03-21 at 01:32 -0400, Ryan Lortie wrote:
It seems that this is a (slightly) recent addition.  It's documented:

       F_DUPFD_CLOEXEC (int; since Linux 2.6.24)

so I'm sure we'll probably still need to write an ifdef with a
fallback...

If you're referring to older Linux versions, I disagree. Even glibc has
dropped support for Linux < 2.6.32, ifdef may be needed for other
kernels, though, not sure.

The wider question about the usefulness of O_CLOEXEC still stands.

I would keep using O_CLOEXEC as it's as close as we can get to the
behavior that should have been the default: don't implicitly inherit
file descriptors on exec.

Maybe there are applications out there that rely on correct file
descriptor flags and directly call fork/exec. You could try to convince
them to switch to GSubprocess (or work around the issue in their own
fork/exec code). However, as I think we all agree that O_CLOEXEC is the
best default behavior, I don't see why we should break these
applications.

Regards,
Jürg



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]