forked from mirrors/tftp-hpa-google
Improve address type error handling
This patch detects numeric address types to avoid unnecessary warnings/errors. It also cleans up error printing to not print error messages on stderr in the deamon case. Signed-off-by: Karsten Keil <kkeil@suse.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
bdb90cf176
commit
18fd18bd5c
4 changed files with 56 additions and 20 deletions
|
@ -310,15 +310,10 @@ set_sock_addr(char *host,union sock_addr *s, char **name)
|
|||
hints.ai_family = s->sa.sa_family;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
err = getaddrinfo(strip_address(host), NULL, &hints, &addrResult);
|
||||
if (err) {
|
||||
printf("Error : %s\n", gai_strerror(err));
|
||||
printf("%s: unknown host\n", host);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
if (addrResult == NULL) {
|
||||
printf("%s: unknown host\n", host);
|
||||
if (addrResult == NULL)
|
||||
return EAI_NONAME;
|
||||
}
|
||||
memcpy(s, addrResult->ai_addr, addrResult->ai_addrlen);
|
||||
if (name) {
|
||||
if (addrResult->ai_canonname)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue