[systemd-devel] [PATCH] Fix strerror_r segfault on non-glibc systems

Lennart Poettering lennart at poettering.net
Thu Mar 29 09:14:26 UTC 2018


On Do, 29.03.18 14:41, Ioan-Adrian Ratiu (adi at adirat.com) wrote:

> POSIX strerror_r returns an int while the glibc "extension" returns a char* and
> this causes segfaults when running on systems with libc's like musl which only
> implement the portable version or deliberately don't provide a flag to identify
> compiling using their headers.
> 
> Glibc provides the POSIX variant of the function, but only if _GNU_SOURCE is
> not set i.e. all gnu extensions are disabled. Meson sets _GNU_SOURCE globally
> at build time.
> 
> So detect during build if we have the char* version and #ifdef the logic.
> 
> Signed-off-by: Ioan-Adrian Ratiu <adi at adirat.com>

Sorry, but as usual: please work with the other libcs to provide glibc
compatibility. At this point glibc is *the* Linux API, and it would be
much easier for everybody if the alternative libcs would just get over
themselves and provide proper compatibility, instead of expecting
people to add hacks to every single package using them.

Thank you for understanding,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list