This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Test for GNU/XSI version of strerror_r
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Ian Pilcher <arequipeno at gmail dot com>
- Cc: libc-help at sourceware dot org
- Date: Fri, 04 Oct 2019 21:37:42 +0200
- Subject: Re: Test for GNU/XSI version of strerror_r
- References: <qn85mr$1bht$1@blaine.gmane.org> <87y2y0nwxf.fsf@mid.deneb.enyo.de> <qn86li$374l$1@blaine.gmane.org>
* Ian Pilcher:
> On 10/4/19 2:16 PM, Florian Weimer wrote:
>> * Ian Pilcher:
>>
>>> Is there a better way to do this?
>>
>> Can you use C++?
>>
>
> Well, I did say better. ;-)
>
> The extension is quite a simple. (It provides a single function, which
> changes to a non-root user while retaining CAP_NET_ADMIN.) It will
> likely weigh in under 100 lines. Also, I haven't touched C++ since the
> 1990s. (I still have the Turbo C++ 3.0 box!)
You could use generic selection and _Generic. But these days, that's
more restrictive than C++ in terms of compiler support.
It's not really defined to add “#define _GNU_SOURCE” after the first
#include, so you could probably just check for _GNU_SOURCE.