Re: [PATCH v4 next 09/23] tools/nolibc: Implement strerror() in terms of strerror_r()

From: David Laight

Date: Sat Mar 07 2026 - 11:55:18 EST


On Sat, 7 Mar 2026 12:37:35 +0100
Willy Tarreau <w@xxxxxx> wrote:

...
> > > > +static __attribute__((unused,))
> > > > +int strerror_r(int errnum, char *buf, size_t buflen __attribute__((unused)))
> > > > +{
> > >
> > > Here I think we can simply do this to comply with the man page:
> > >
> > > if (buflen < 18) {
> > > errno = ERANGE;
> > > return -1;
> >
> > Looks like it should 'return ERANGE' (matching glibc 2.13+).
>
> Ah you're right, I initially misunderstood the man page as "a positive
> number with errno set". But yes, returning ERANGE is fine!

Which also means I got the return value wrong when I made it
return the length.

Might be easiest to apply these patches and then fix it up?

David