Short version: For recent libc releases, and at least on Gentoo,
getgrent() and endgrent() seem to magically set errno to EINVAL (I
think), except when errno's value is actually meaningful.
> (...)
End of file or error (errno = Success)
errno = Invalid argument
POSIX says:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endgrent.html

"The setgrent() and endgrent() functions shall not change the setting of
errno if successful."

So I'd advise reporting the bug to the glibc maintainers.

--
Laurent

Reply via email to