[vlc-devel] [PATCH] Don't assume O_CLOEXEC is defined

Pierre Ynard linkfanel at yahoo.fr
Thu Jan 5 01:16:37 CET 2012

> >> Perhaps it could go in vlc_fs.h as
> >> #ifndef O_CLOEXEC
> >> # define O_CLOEXEC 0
> >> #endif

That looks like a better approach to me.

> > Linux support for close-on-exec is in the kernel, not libc. And
> > that is irrelevant. What is relevant is your patch brings back a
> > well-known annoying old bug, leaking of device nodes through child
> > processes.
> The flag is actually used where possible .. so it's not "bringing back"
> a bug, but let VLC build (and leak device nodes through child processes)
> on systems without O_CLOEXEC.

I think that if O_CLOEXEC is unavailable, you can still try setting
FD_CLOEXEC with fcntl(). That leaves a race condition, but that's for
fixing this very issue that O_CLOEXEC is needed.


Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."

More information about the vlc-devel mailing list