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.