Nowadays (since 2.3.4) glibc only sets the first ai_canonname

field if AI_CANONNAME was specified (the current
behavior is all that SUSv3 requires).
This commit is contained in:
Michael Kerrisk 2005-08-09 10:10:29 +00:00
parent 37894cb3e3
commit 8194de3393
1 changed files with 12 additions and 5 deletions

View File

@ -86,13 +86,13 @@ structure used by this function contains the following members:
.BR getaddrinfo (3)
sets
.I res
to point to a dynamically-allocated link list of
to point to a dynamically-allocated linked list of
.B addrinfo
structures, linked by the
.I ai_next
member.
There are several reasons why
the link list may have more than one
the linked list may have more than one
.B addrinfo
structure, including: if the network host is
multi-homed; or if the same service
@ -180,20 +180,27 @@ flag suppresses any potentially lengthy network host address lookups.
.PP
The
.BR getaddrinfo (3)
function creates a link list of
function creates a linked list of
.B addrinfo
structures, one for each network address subject to any restrictions
imposed by the
.I hints
parameter.
The
.I ai_canonname
is set to point to the official name of the host, if
field of the first of these
.B addrinfo
structures is set to point to the official name of the host, if
.I ai_flags
in
.I hints
includes the
.B AI_CANONNAME
flag.
.\" In glibc prior to 2.3.4, the ai_canonname of each addrinfo
.\" structure was set pointing to the canonical name; that was
.\" more than SUSv3 specified, or other implementations provided.
.\" MTK, Aug 05
.IR ai_family ,
.IR ai_socktype ,
and
@ -239,7 +246,7 @@ is NULL the port number will be left uninitialized.
The
.BR freeaddrinfo (3)
function frees the memory that was allocated
for the dynamically allocated link list
for the dynamically allocated linked list
.IR res .
.SH "RETURN VALUE"
.BR getaddrinfo (3)