lvmpolld: _strerror_r has return type 'const char *' but returns 'int' with musl libc
Closed this issue · 1 comments
marv commented
Building LVM 2.03.16 on a musl-based system I get the following warning:
lvmpolld-core.c: In function '_strerror_r':
lvmpolld-core.c:56:16: warning: returning 'int' from a function with return type 'const char *' makes pointer from integer without a cast [-Wint-conversion]
56 | return strerror_r(errnum, data->buf, sizeof(data->buf)); /* never returns NULL */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Recent compilers are getting stricter and with clang-15.0.0 this is now an error
musl declares strerror_r
as:
int strerror_r (int, char *, size_t);
while glibc declares it as:
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
musl's is compliant with POSIX, which states:
#include <string.h>
char *strerror(int errnum);
int strerror_r(int errnum, char *strerrbuf, size_t buflen);
zkabelac commented