Manual update for get.*_r functions
Andreas Jaeger
aj@arthur.rhein-neckar.de
Wed Jun 30 12:42:00 GMT 1999
>>>>> Ulrich Drepper writes:
Uli> Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:
>> I'm appending a patch for the manual to document the POSIX behaviour
>> to summarize my understanding of the issue.
Uli> The test for a NULL pointer should not be necessary. Where did you
Uli> find this necessary? It is then a bug in the NSS backend.
I've checked POSIX and my understanding of POSIX is that the check for
NULL is necessary.
Check the appended test program with the following line in
nsswitch.conf:
hosts: files dns
Andreas
#include <netdb.h>
#include <stdio.h>
#include <alloca.h>
int
main (void)
{
struct hostent hostbuf, *hp;
size_t hstbuflen;
char *tmphstbuf;
int res;
int herr;
hstbuflen = 1024;
tmphstbuf = alloca (hstbuflen);
res = gethostbyname_r ("unknownhost", &hostbuf, tmphstbuf, hstbuflen, &hp, &herr);
printf ("gethostbyname_r returned: %d\n", res);
printf ("herr: %d\n", herr);
printf ("hp is %s\n", hp == NULL ? "null" : "set");
return res;
}
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de
More information about the Libc-hacker
mailing list