Hello!

The getaddrinfo(3) function appears to have bogus behavior on
‘i386-apple-darwin9.2.2’ (Darwin 9.6 apparently doesn’t have the
problem).  Here’s the test program:

--8<---------------cut here---------------start------------->8---
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int
main (int argc, char *argv[])
{
  int err;
  struct addrinfo *res, hints;

  memset (&hints, 0, sizeof (hints));
  err = getaddrinfo (NULL, "does-not-exist", &hints, &res);
  printf ("err = %i `%s'\n", err, gai_strerror (err));

  return err != 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--8<---------------cut here---------------end--------------->8---

Here, I’d expect either ‘EAI_NONAME’ or ‘EAI_SERVICE’ (glibc 2.11
returns the latter on GNU/Linux).  On ‘i386-apple-darwin9.2.2’ it
succeeds:

  err = 0 `Unknown error'

My guess is that it’s a bug.  What do you think?

If it is indeed a bug, should we try to work around it in Gnulib?
Any idea how this could be done?

Thanks,
Ludo’.


Reply via email to