A new glibc bug
Andreas Jaeger
aj@arthur.rhein-neckar.de
Sun Jun 27 23:25:00 GMT 1999
Appended is a small test program that shows the problem. The output
is (with current glibc cvs 2.1.2):
$ ./gethst_r-test
gethostbyname_r returned: 0
herr: 1
hp is null
But shouldn't gethostbyname_r return a nonzero value?
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