Add NI_NAMEREQD flag to getnameinfo() call. Without this flag,

getnameinfo() don't return error at name resolving failure.
But it is used at doaddrlookup(-N) case in telnet, error need to be
returned to correctly initialize hostname buffer.

Discovered at checking recent KAME repository change, noticed by itojun.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@56870 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
shin 2000-01-29 18:21:05 +00:00
parent 32ca7e751c
commit 845ce56d7b

View File

@ -2451,7 +2451,7 @@ tn(argc, argv)
if (doaddrlookup)
gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len,
_hostname, sizeof(_hostname) - 1, NULL, 0,
0);
NI_NAMEREQD);
if (gni_err != 0)
(void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);
_hostname[sizeof(_hostname)-1] = '\0';