This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Calling properly getpwuid_r


On 12 February 2013 21:11, Thomas Segismont <tsegismo@redhat.com> wrote:
> On the libc manual, there is an example on how to call gethostbyname_r:
> http://www.gnu.org/software/libc/manual/html_node/Host-Names.html
>
> As getpwuid_r seems to be backed by the same code in getXXbyYY_r.c, is it
> also recommended to call it in a while loop to deal with erange errors?

Yes.

> Is there a particular reason for this?

The string fields in the struct paswd returned are stored in the
caller-supplied buffer.  The call will return ERANGE if the buffer is
not large enough.


-- 
http://siddhesh.in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]