_XOPEN_SOURCE in ntpd/refclock_gpsd.c => warnings on BSD

Achim Gratz Stromeko at nexgo.de
Sat Aug 24 09:51:58 UTC 2019


Hal Murray via devel writes:
>> I see no changes related to _XOPEN_SOURCE since 2017.  Perhaps you're
>> thinking of GPSD, where there was bunch of rework in that area just before
>> the 3.19 release.  
>
> Thanks.  You are probably right.
>
> Eric:  This area just got more complicated.  See #614
> strerror_r() has two modes depending on
>            The XSI-compliant version is provided if:
>            (_POSIX_C_SOURCE >= 200112L) && !  _GNU_SOURCE
>            Otherwise, the GNU-specific version is provided.

Then don't define _GNU_SOURCE, the _POSIX_C_SOURCE should already be at
a high enough level on any halfway modern Linux system.  Please note
that glibc until version 2.13 did not in fact provide a POSIX compliant
version.

> Our code is (sometimes?) assuming the wrong one.  The GNU version (sometimes?) 
> doesn't put the string into the buffer we are printing.

"The GNU-specific strerror_r() returns a pointer to a string containing
 the error message.  This may be either a pointer to a string that the
 function stores in buf, or a pointer to some (immutable) static string
 (in which case buf is unused).  If the function stores a string in buf,
 then at most buflen bytes are stored (the string may be truncated if
 buflen is too small and errnum is unknown).  The string always includes
 a terminating null byte ('\0')."


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



More information about the devel mailing list