close-on-exec

Emil Velikov emil.l.velikov at gmail.com
Thu Feb 26 17:26:26 PST 2015


On 27 February 2015 at 01:02, Alan Coopersmith
<alan.coopersmith at oracle.com> wrote:
> 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.
>
Hmm you are correct here. I was naively assuming that the compiler
will parse this and error out.
Ignore I said anything :-)

-Emil


More information about the xorg-devel mailing list