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.
This commit is contained in:
Yoshinobu Inoue 2000-01-29 18:21:05 +00:00
parent ac0711e123
commit 0bd288cd6c
3 changed files with 3 additions and 3 deletions

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';

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';

View File

@ -2274,7 +2274,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';