close-on-exec

Alan Coopersmith alan.coopersmith at oracle.com
Thu Feb 26 17:02:35 PST 2015


On 02/26/15 08:04 AM, Emil Velikov wrote:
> On 25/02/15 22:27, Alan Coopersmith wrote:
>> I'm not sure what more we can do.  I have no idea how to write a configure
>> check to test for fopen(..., "e") support either.)
>>
> Something like the following should be ok, but I haven't tested it.
>
> AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> #define _POSIX_SOURCE
> #include <stdio.h>
>
> int main () {
>      FILE *fp;
>      fp = fopen("/tmp/foo", "e");
>      return 0;
> }]])], AC_DEFINE([HAVE_FOPEN_E], [1],
>                   [Define if fopen(... , "e") exists.])
> )

Since the argument is just a string, it will compile fine, since I don't
know of any compiler that tries to parse & check fopen() option strings - it
would have to be a runtime test, and I don't know if all implementations
that don't support the "e" modifier (I think you still need the "r" or "w"
base) will report an error from it, or if some just ignore it.

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


More information about the xorg-devel mailing list