1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmpolld: fix strerror_r check for musl

We can't assume that strerror_r returns char* just because _GNU_SOURCE is
defined. We already call the appropriate autoconf test, so let's use its
result (STRERROR_R_CHAR_P).

Note that in configure, _GNU_SOURCE is always set, but we add a defined
guard just in case for futureproofing.

Bug: https://bugs.gentoo.org/869404
This commit is contained in:
Sam James 2022-11-19 17:51:09 +01:00 committed by Zdenek Kabelac
parent 3dee7b7266
commit fdd8feb60e

View File

@ -52,7 +52,7 @@ static pthread_key_t key;
static const char *_strerror_r(int errnum, struct lvmpolld_thread_data *data)
{
#ifdef _GNU_SOURCE
#if defined(_GNU_SOURCE) && defined(STRERROR_R_CHAR_P)
return strerror_r(errnum, data->buf, sizeof(data->buf)); /* never returns NULL */
#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
return strerror_r(errnum, data->buf, sizeof(data->buf)) ? "" : data->buf;