Comment 8 for bug 933943

Revision history for this message
In , Theinric (theinric) wrote :

Hi, I have several remarks.

There's a potential for an endless loop in not so unrealistic conditions.

Every other error besides ERANGE causes this. E.g. referencing a non-existent group. Others can be caused by missing permissions, wrong configuration in /etc/nsswitch.conf, etc.

Attached is a patch that should mitigate this. Manpages are a bit ambiguous about how getgrnam_r() reports errors, but it looks safe to ignore errno completely and rely on the return code.

The patch is for 5.10.2 but the code in v7 is almost identical.