Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lvmpolld: _strerror_r has return type 'const char *' but returns 'int' with musl libc #91

Closed
marv opened this issue Sep 15, 2022 · 1 comment

Comments

@marv
Copy link

marv commented Sep 15, 2022

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);

https://www.unix.com/man-page/posix/3posix/strerror_r/

@zkabelac
Copy link

zkabelac commented Feb 1, 2023

Upstream fix:
https://listman.redhat.com/archives/lvm-devel/2022-November/024479.html

@zkabelac zkabelac closed this as completed Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants