[PATCH] Use O_CLOEXEC for internal file descriptors

Mark Kettenis mark.kettenis at xs4all.nl
Mon Feb 27 13:22:15 PST 2012


> Date: Mon, 27 Feb 2012 10:41:15 -0800
> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> 
> On 02/27/12 08:35 AM, Adam Jackson wrote:

> > Well, almost all of them.  zlib doesn't support "e" in the mode
> > string in gzopen() though it will silently accept and ignore it,
> > and Solaris appears not to support "e" in the mode string at all.
> 
> Right - I filed an enhancement request for that at one point but it
> hasn't been added yet, so for now, on Solaris we have to do
> 	fd = open(..., O_CLOEXEC);
> 	fp = fdopen(fd, ...);

That is of course a much better suggestion.  And it is possible to use
the same trick with gzdopen(3) to work around the fact that gzopen()
doesn't suppert "e", even on Linux systems.


More information about the xorg-devel mailing list