[PATCH] Use O_CLOEXEC for internal file descriptors

Alan Coopersmith alan.coopersmith at oracle.com
Mon Feb 27 10:41:15 PST 2012


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, ...);

As far as I know, "e" in fopen() flags is currently limited to glibc since
Ulrich seems to have created it: http://udrepper.livejournal.com/20407.html

> +#if defined(linux) && !defined(__GNU_SOURCE)
> +#define __GNU_SOURCE
> +#endif

Wouldn't AC_USE_SYSTEM_EXTENSIONS in configure.ac cover this, as well as making
it more likely to enable non-standard extensions such as this on other OSes?

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list