--- musl-1.1.16.orig/src/passwd/getgr_r.c +++ musl-1.1.16/src/passwd/getgr_r.c @@ -1,5 +1,6 @@ #include "pwf.h" #include +#include #define FIX(x) (gr->gr_##x = gr->gr_##x-line+buf) @@ -19,6 +20,7 @@ if (*res && size < len + (nmem+1)*sizeof(char *) + 32) { *res = 0; rv = ERANGE; + errno = ERANGE; } if (*res) { buf += (16-(uintptr_t)buf)%16; --- musl-1.1.16.orig/src/passwd/getpw_r.c +++ musl-1.1.16/src/passwd/getpw_r.c @@ -1,5 +1,6 @@ #include "pwf.h" #include +#include #define FIX(x) (pw->pw_##x = pw->pw_##x-line+buf) @@ -16,6 +17,7 @@ if (*res && size < len) { *res = 0; rv = ERANGE; + errno = ERANGE; } if (*res) { memcpy(buf, line, len); --- musl-1.1.16.orig/src/passwd/getspnam_r.c +++ musl-1.1.16/src/passwd/getspnam_r.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "pwf.h" /* This implementation support Openwall-style TCB passwords in place of @@ -104,6 +105,7 @@ } if (buf[k-1] != '\n') { rv = ERANGE; + errno = ERANGE; break; }