mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Call getnameinfo with NI_NAMEREQD flag.
This way net_gethostbyaddr will fail when the system is unable to resolve the address to a valid host name. Without this flag in case of failure the function would return the ip address instead of failing.
This commit is contained in:
parent
f31b2026b4
commit
118eb0a68c
1 changed files with 4 additions and 2 deletions
|
|
@ -447,8 +447,10 @@ int net_gethostbyaddr(IPADDR *ip, char **name)
|
|||
sin_set_ip(&so, ip);
|
||||
|
||||
/* save error to host_error for later use */
|
||||
host_error = getnameinfo((struct sockaddr *) &so, sizeof(so),
|
||||
hostname, sizeof(hostname), NULL, 0, 0);
|
||||
host_error = getnameinfo((struct sockaddr *)&so, sizeof(so),
|
||||
hostname, sizeof(hostname),
|
||||
NULL, 0,
|
||||
NI_NAMEREQD);
|
||||
if (host_error != 0)
|
||||
return host_error;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue