[PATCH] Make getlogin_r thread safe

Roland McGrath roland@redhat.com
Tue Oct 15 20:04:00 GMT 2002


This change is wrong because it causes getutline_r to rewind on every call
and so only ever return the first match in the file.  That's not what the
function is defined to do, regardless of the fact that more than one match
for a line doesn't normally occur in utmp.

I have instead changed getlogin_r so that it holds the lock during the
entire search, by using the internal functions instead of __setutent et al.
This passes make check, but I have not done any real testing on a live system.



More information about the Libc-alpha mailing list