This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [PATCH] Make getlogin_r thread safe
- From: Roland McGrath <roland at redhat dot com>
- To: Steve Munroe <sjmunroe at vnet dot ibm dot com>
- Cc: libc-alpha at sources dot redhat dot com, bergner at us dot ibm dot com
- Date: Tue, 15 Oct 2002 20:03:58 -0700
- Subject: Re: [PATCH] Make getlogin_r thread safe
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.