MFC:
ensure the head entry of addrinfo chain has non-NULL ai_canonname to be compliant with RFC3493. PR: standards/114910 Approved by: ume (mentor) lib/libc/net/getaddrinfo.c: 1.86
This commit is contained in:
parent
1d2954da88
commit
a5dfa0a1a7
@ -570,8 +570,24 @@ good:
|
||||
* in the most efficient order.
|
||||
*/
|
||||
if (hints == NULL || !(hints->ai_flags & AI_PASSIVE)) {
|
||||
if (!numeric)
|
||||
if (!numeric) {
|
||||
char *canonname;
|
||||
|
||||
canonname =
|
||||
sentinel.ai_next->ai_canonname;
|
||||
if (canonname != NULL) {
|
||||
sentinel.ai_next->ai_canonname
|
||||
= NULL;
|
||||
}
|
||||
(void)reorder(&sentinel);
|
||||
if (sentinel.ai_next->ai_canonname ==
|
||||
NULL) {
|
||||
sentinel.ai_next->ai_canonname
|
||||
= canonname;
|
||||
} else {
|
||||
free(canonname);
|
||||
}
|
||||
}
|
||||
}
|
||||
*res = sentinel.ai_next;
|
||||
return SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user