strerror_r used as non-portable format

Bug #1857099 reported by Luiz Angelo Daros de Luca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
elfutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

I got a elfutils-0.178

glibc provides two different signatures for strerror_r. One is GNU-specific and it is not portable.
The other is

       int strerror_r(int errnum, char *buf, size_t buflen);
                   /* XSI-compliant */

       char *strerror_r(int errnum, char *buf, size_t buflen);
                   /* GNU-specific */

man strerror(3) says:

       The XSI-compliant strerror_r() is preferred for portable applications. It returns the error string in the user-supplied buffer buf of length buflen.

musl implements strerror_r as XSI-compliant version while elfutils uses GNU-specific variant.

The solution should not simply ignore strerror_r return value as it would break build when -Werror=unused-result is set.

An alternative is to do something like: https://github.com/luizluca/openwrt/blob/a79698fefdd9dacb84865c870bf75aee978c005d/package/libs/elfutils/patches/100-musl-compat.patch#L51

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.