This is the mail archive of the glibc-bugs@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]

[Bug network/14990] getaddrinfo with servname=NULL returns duplicate addresses


http://sourceware.org/bugzilla/show_bug.cgi?id=14990

--- Comment #2 from Pavel Åimerda <psimerda at redhat dot com> 2013-01-11 15:58:28 UTC ---
The code for #3a could look something like this:

  if (!servname)
    {
      /* POSIX1-2008: If servname is null, the call shall return network-level
       * addresses for the specified nodename.
       *
       * Example:
       *
       * getaddrinfo ("localhost", NULL, ...) ->
       *   family=AF_INET6 socktype=0 protocol=0 address=::1 port=0
       *   family=AF_INET socktype=0 protocol=0 address=127.0.0.1 port=0
       */
      struct gaih_servtuple *st = malloc (sizeof (struct gaih_servtuple));
      st->next = NULL;
      st->port = 0;
      /* Copy socktype and protocol from the request. This maintains backwards
       * compatibility. Callers should not set socktype and protocol when
       * service is NULL.
       */
      st->socktype = socktype;
      st->protocol = protocol;

      *servtuple = st;
      return 0;
    }

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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