Yo Rich! On Wed, 13 Apr 2022 10:05:33 -0400 Rich Felker wrote: > > > When _GNU_SOURCE is defined with glibc, then strerror_r() returns > > > a char *. > > > > I have met this in multiple places the last decade. The usual way to > > fix it is to also check for GNU libc in addition to _GNU_SOURCE. > > > > #if defined (__GLIBC__) && defined (_GNU_SOURCE) > > /* non-standard GLIBC exception */ > > #else > > /* standard behavior for everything else */ > > #endif > > That, or probe for the signature with a configure-style check and use > the result of that, as in > > #ifdef HAVE_GNU_STRERROR_R > // handle the GNU version > #else > // code written to the standard > #endif gpsd runs on a huge variety of hardware and software. We used to have rats nests of #ifdef's as suggested above. But that only works when your library code actually follows your documentation, and our dev actually read and understood your documentation. Since you doc fails to mention this "quirk", it is not possible to forsee this issue before debugging the rare crash. Now consider that gpsd supports well over 100 targets, back to POSIX 2001. glibc has a long history of changes around strerror_r(), and gpsd has to support each one. Then there are all the other libc. That is a lot of doc to check. And a lot of #ifdeff version chacks. OBTW: did I mention musl does not appear to have any #defines to specify its current version? Or even that it is musl? Or did I miss something else in the doc? So you expect me to use the glibc #defines, because musl lacks them. Not practical at scale. gpsd prefers to check at configure time for all the known library calls that are "quirky". So, what I did was add, yet another, configure time tesst RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 gem@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can't measure it, you can't improve it." - Lord Kelvin